diff --git a/.gitignore b/.gitignore index 48acdb9..ded680c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,38 @@ # Compiled Object files +*.obj *.slo *.lo -*.o *.obj +*.o -log.txt +# Visual Studio +*.pdb +*.ilk +*.sdf +*.suo +*.log +*.tlog +*.ipch +*.pdb +*.exp +*.opensdf +*.user +*.filters +*.exe.manifest -objects/ +*.exe +log.txt -third-party-libs/wxWidgets +!FragmentFramework.exp +!FragmentFramework.pdb +!FragmentFramework-debug.exp +!FragmentFramework-debug.pdb -# Code::Blocks files +# Code::Blocks *.layout +*.save +*.save-failed +*.save-fail *.depend + +objects/ diff --git a/SM2OBJ.cbp b/SM2OBJ.cbp index edc11d4..a805544 100644 --- a/SM2OBJ.cbp +++ b/SM2OBJ.cbp @@ -15,13 +15,14 @@ - - + + - - - + + + + @@ -32,14 +33,15 @@ - - + + - - + + + @@ -73,7 +75,6 @@ - @@ -82,14 +83,11 @@ - - - - + diff --git a/SM2OBJ.sln b/SM2OBJ.sln new file mode 100644 index 0000000..6289603 --- /dev/null +++ b/SM2OBJ.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Express 2013 for Windows Desktop +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SM2OBJ", "SM2OBJ.vcxproj", "{DC37F45B-306F-41D5-930D-82C708856CF1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DC37F45B-306F-41D5-930D-82C708856CF1}.Debug|Win32.ActiveCfg = Debug|Win32 + {DC37F45B-306F-41D5-930D-82C708856CF1}.Debug|Win32.Build.0 = Debug|Win32 + {DC37F45B-306F-41D5-930D-82C708856CF1}.Release|Win32.ActiveCfg = Release|Win32 + {DC37F45B-306F-41D5-930D-82C708856CF1}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/SM2OBJ.vcxproj b/SM2OBJ.vcxproj new file mode 100644 index 0000000..075cd0f --- /dev/null +++ b/SM2OBJ.vcxproj @@ -0,0 +1,137 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {DC37F45B-306F-41D5-930D-82C708856CF1} + Win32Proj + MySM2OBJ + + + + Application + true + v120 + Unicode + + + Application + false + v120 + true + Unicode + + + + + + + + + + + + + true + release\ + objects\release\msvc + SM2OBJ-debug + false + + + false + release\ + objects\debug\msvc + SM2OBJ + false + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + true + dependencies\zlib\include;dependencies\FragmentFramework\include;%(AdditionalIncludeDirectories) + + + Console + true + FragmentFramework-debug.lib;libz.lib;%(AdditionalDependencies) + dependencies\zlib\lib\msvc;dependencies\FragmentFramework\lib\msvc;%(AdditionalLibraryDirectories) + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + true + dependencies\zlib\include;dependencies\FragmentFramework\include;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + FragmentFramework.lib;libz.lib;%(AdditionalDependencies) + dependencies\zlib\lib\msvc;dependencies\FragmentFramework\lib\msvc;%(AdditionalLibraryDirectories) + main + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/config.h b/dependencies/FragmentFramework/include/config.h new file mode 100644 index 0000000..a576155 --- /dev/null +++ b/dependencies/FragmentFramework/include/config.h @@ -0,0 +1,24 @@ +#ifndef FFW_CONFIG +#define FFW_CONFIG + +#if __cplusplus < 201103L +// #error This library needs at least a C++11 compliant compiler +#endif + +#define UNICODE 1 + +#ifdef FFW_EXPORTS +#define FFW_API __declspec(dllexport) +#else +#define FFW_API __declspec(dllimport) +#endif + +#ifdef _MSC_VER +#define _USING_MSVC +#pragma warning( disable: 4251 ) +#endif +#ifdef __MINGW32__ +#define _USING_MINGW +#endif + +#endif diff --git a/dependencies/FragmentFramework/include/ffw.h b/dependencies/FragmentFramework/include/ffw.h new file mode 100644 index 0000000..ba598a2 --- /dev/null +++ b/dependencies/FragmentFramework/include/ffw.h @@ -0,0 +1,55 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FRAGMENT_FRAMEWORK +#define FRAGMENT_FRAMEWORK + +#include "config.h" +#include "gl/monitors.hpp" +#include "gl/extensions.hpp" +#include "graphics/basicDraw.hpp" +#include "graphics/bufferObjectPool.hpp" +#include "graphics/bufferObject.hpp" +#include "graphics/framebuffer.hpp" +#include "graphics/shader.hpp" +#include "graphics/texture2D.hpp" +#include "graphics/texture2DArray.hpp" +#include "graphics/font.hpp" +#include "math/math.h" +#include "network/networkUtils.hpp" +#include "network/udpListener.hpp" +#include "network/udpSender.hpp" +#include "network/tcpServer.hpp" +#include "network/tcpClient.hpp" +#include "serial/serialManager.hpp" +#include "systemUserInterface/uiWindow.hpp" +#include "systemUserInterface/uiButton.hpp" +#include "systemUtils/directory.hpp" +#include "systemUtils/win32SysUtils.hpp" +#include "utilities/fileUtilities.hpp" +#include "fileLoaders/bmpFile.hpp" +#include "fileLoaders/jsonFile.hpp" +#include "fileLoaders/objFile.hpp" +#include "fileLoaders/pbmFile.hpp" +#include "fileLoaders/pngFile.hpp" +#include "fileLoaders/jpgFile.hpp" +#include "fileLoaders/txtFile.hpp" +#include "fileLoaders/tgaFile.hpp" +#include "fileLoaders/tiffFile.hpp" +#include "fileLoaders/wavFile.hpp" +#include "fileLoaders/xmlFile.hpp" +#include "fileLoaders/oggFile.hpp" +#include "utilities/file.hpp" +#include "utilities/logger.hpp" +#include "utilities/thread.hpp" +#include "utilities/usleep.hpp" +#include "utilities/mutex.hpp" +#include "utilities/timer.hpp" +#include "utilities/serialization.hpp" +#include "render/renderContext.hpp" +#include "render/appRenderWindow.hpp" + +#endif diff --git a/dependencies/FragmentFramework/include/fileLoaders/audioFile.hpp b/dependencies/FragmentFramework/include/fileLoaders/audioFile.hpp new file mode 100644 index 0000000..fcc7f25 --- /dev/null +++ b/dependencies/FragmentFramework/include/fileLoaders/audioFile.hpp @@ -0,0 +1,224 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_LOAD_SAVE_AUDIO +#define FFW_LOAD_SAVE_AUDIO + +#include "../config.h" +#include "../utilities/fileUtilities.hpp" +#include + +/*! + @ingroup Utilities +*/ +namespace ffw{ + /*! + @memberof ffw + @ingroup Utilities + */ + class FFW_API audioFileLoader { + public: + audioFileLoader(); + virtual ~audioFileLoader(); + /*! + @memberof audioFileLoader + @ingroup Utilities + @pure + */ + virtual bool open(const std::string& Path) = 0; + /*! + @memberof audioFileLoader + @ingroup Utilities + @pure + */ + virtual bool open(const std::wstring& Path) = 0; + /*! + @memberof audioFileLoader + @ingroup Utilities + @pure + */ + virtual void close() = 0; + /*! + @memberof audioFileLoader + @ingroup Utilities + @pure + */ + virtual bool readChunk(unsigned char* Bytes, size_t* BytesOut) = 0; + /*! + @memberof audioFileLoader + @ingroup Utilities + @pure + */ + virtual bool skipChunk(size_t* BytesOut) = 0; + /*! + @memberof audioFileLoader + @ingroup Utilities + @pure + */ + virtual bool reset() = 0; + /*! + @memberof audioFileLoader + @ingroup Utilities + @pure + */ + virtual bool eof() = 0; + /*! + @memberof audioFileLoader + @ingroup Utilities + @pure + */ + virtual size_t getPos() = 0; + /*! + @memberof audioFileLoader + @ingroup Utilities + */ + bool isOpen() const; + /*! + @memberof audioFileLoader + @ingroup Utilities + */ + size_t getSize() const; + /*! + @memberof audioFileLoader + @ingroup Utilities + */ + int getSampleRate() const; + /*! + @memberof audioFileLoader + @ingroup Utilities + */ + int getNumOfChannels() const; + /*! + @memberof audioFileLoader + @ingroup Utilities + */ + int getBitsPerSample() const; + /*! + @memberof audioFileLoader + @ingroup Utilities + */ + size_t getChunkSize() const; + /*! + @memberof audioFileLoader + @ingroup Utilities + */ + operator bool () const; + + protected: + audioFileLoader(const audioFileLoader& Other) = default; + audioFileLoader& operator = (const audioFileLoader& Other) = default; + bool loaded; + size_t size; + int sampleRate; + int channelCount; + int bitsPerSample; + size_t chunkSize; + }; + + /*! + @memberof ffw + @ingroup Utilities + */ + class FFW_API audioFileSaver { + public: + audioFileSaver(); + virtual ~audioFileSaver(); + /*! + @memberof audioFileSaver + @ingroup Utilities + @pure + */ + virtual bool open(const std::string& Path, int BitsPerSample, size_t Size, int SampleRate, int NumChannels, int Kbps) = 0; + /*! + @memberof audioFileSaver + @ingroup Utilities + @pure + */ + virtual bool open(const std::wstring& Path, int BitsPerSample, size_t Size, int SampleRate, int NumChannels, int Kbps) = 0; + /*! + @memberof audioFileSaver + @ingroup Utilities + @pure + */ + virtual bool writeChunk(unsigned char* Data, size_t* BytesWritten) = 0; + /*! + @memberof audioFileSaver + @ingroup Utilities + @pure + */ + virtual bool writeFooter() = 0; + /*! + @memberof audioFileSaver + @ingroup Utilities + @pure + */ + virtual void close() = 0; + /*! + @memberof audioFileSaver + @ingroup Utilities + @pure + */ + virtual bool eof() = 0; + /*! + @memberof audioFileSaver + @ingroup Utilities + @pure + */ + virtual size_t getPos() = 0; + /*! + @memberof audioFileSaver + @ingroup Utilities + */ + bool isOpen() const; + /*! + @memberof audioFileSaver + @ingroup Utilities + */ + size_t getSize() const; + /*! + @memberof audioFileSaver + @ingroup Utilities + */ + int getSampleRate() const; + /*! + @memberof audioFileSaver + @ingroup Utilities + */ + int getNumOfChannels() const; + /*! + @memberof audioFileSaver + @ingroup Utilities + */ + int getBitsPerSample() const; + /*! + @memberof audioFileSaver + @ingroup Utilities + */ + size_t getChunkSize() const; + /*! + @memberof audioFileSaver + @ingroup Utilities + */ + operator bool () const; + protected: + audioFileSaver(const audioFileSaver& Other) = default; + audioFileSaver& operator = (const audioFileSaver& Other) = default; + bool loaded; + size_t size; + int sampleRate; + int channelCount; + int bitsPerSample; + size_t chunkSize; + }; + + template class audioLoader: public audioFileLoader { + }; + + template class audioSaver: public audioFileSaver { + }; +}; +#endif + diff --git a/dependencies/FragmentFramework/include/fileLoaders/bmpFile.hpp b/dependencies/FragmentFramework/include/fileLoaders/bmpFile.hpp new file mode 100644 index 0000000..21b1e94 --- /dev/null +++ b/dependencies/FragmentFramework/include/fileLoaders/bmpFile.hpp @@ -0,0 +1,140 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_LOAD_SAVE_BMP +#define FFW_LOAD_SAVE_BMP + +#include "imageFile.hpp" + +/*! + @ingroup Utilities +*/ +namespace ffw{ + class bmpFile{}; + /*! + @memberof ffw + @ingroup Utilities + @sa imageFileLoader + @inherit imageFileLoader + */ + template <> class FFW_API imageLoader: public imageFileLoader { + public: + imageLoader(); + /*! + @memberof imageLoader + @ingroup Utilities + */ + imageLoader(imageLoader&& Other); + ~imageLoader(); + /*! + @memberof imageLoader + @ingroup Utilities + */ + bool open(const std::string& Path) override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + bool open(const std::wstring& Path) override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + void close() override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + bool readRow(unsigned char* Pixels) override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + imageLoader& operator = (imageLoader&& Other); + // Copy constructor is not allowed + imageLoader(const imageLoader& Other) = delete; + // Copy assigment is not allowed + imageLoader& operator = (const imageLoader& Other) = delete; + + private: + class impl; + impl* pimpl; + }; + + /*! + @memberof ffw + @ingroup Utilities + */ + template <> class FFW_API imageSaver: public imageFileSaver { + public: + imageSaver(); + /*! + @memberof imageSaver + @ingroup Utilities + */ + imageSaver(imageSaver&& Other); + ~imageSaver(); + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool open(const std::string& Path, int Width, int Height, imageType Type) override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool open(const std::wstring& Path, int Width, int Height, imageType Type) override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + void close() override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool writeRow(unsigned char* Pixels) override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool writeFooter() override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + imageSaver& operator = (imageSaver&& Other); + // Copy constructor is not allowed + imageSaver(const imageSaver& Other) = delete; + // Copy assigment is not allowed + imageSaver& operator = (const imageSaver& Other) = delete; + + private: + class impl; + impl* pimpl; + }; + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API loadBMP(const std::string& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API saveBMP(const std::string& Path, unsigned char* Pixels, int Width, int Height, imageType Type); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API loadBMP(const std::wstring& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API saveBMP(const std::wstring& Path, unsigned char* Pixels, int Width, int Height, imageType Type); +}; +#endif diff --git a/dependencies/FragmentFramework/include/fileLoaders/geomFile.hpp b/dependencies/FragmentFramework/include/fileLoaders/geomFile.hpp new file mode 100644 index 0000000..7ab3ce5 --- /dev/null +++ b/dependencies/FragmentFramework/include/fileLoaders/geomFile.hpp @@ -0,0 +1,163 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_LOAD_SAVE_GEOMETRY +#define FFW_LOAD_SAVE_GEOMETRY + +#include "../config.h" +#include "../utilities/fileUtilities.hpp" +#include + +/*! + @ingroup Utilities +*/ +namespace ffw{ + /*! + @memberof ffw + @ingroup Utilities + */ + class FFW_API geometryFileLoader { + public: + geometryFileLoader(); + virtual ~geometryFileLoader(); + /*! + @memberof geometryFileLoader + @ingroup Utilities + @pure + */ + virtual bool open(const std::string& Path) = 0; + /*! + @memberof geometryFileLoader + @ingroup Utilities + @pure + */ + virtual bool open(const std::wstring& Path) = 0; + /*! + @memberof geometryFileLoader + @ingroup Utilities + @pure + */ + virtual void close() = 0; + /*! + @memberof geometryFileLoader + @ingroup Utilities + @pure + */ + virtual bool eof() const = 0; + /*! + @memberof geometryFileLoader + @ingroup Utilities + @pure + */ + virtual bool loadObject(unsigned int Index) = 0; + /*! + @memberof geometryFileLoader + @ingroup Utilities + @pure + */ + virtual unsigned int getObjectCount() const = 0; + /*! + @memberof geometryFileLoader + @ingroup Utilities + @pure + */ + virtual unsigned int hasObjectVertices(unsigned int Index) const = 0; + /*! + @memberof geometryFileLoader + @ingroup Utilities + @pure + */ + virtual unsigned int hasObjectNormals(unsigned int Index) const = 0; + /*! + @memberof geometryFileLoader + @ingroup Utilities + @pure + */ + virtual unsigned int hasObjectTexPos(unsigned int Index) const = 0; + /*! + @memberof geometryFileLoader + @ingroup Utilities + @pure + */ + virtual const std::string& getObjectName(unsigned int Index) const = 0; + /*! + @memberof geometryFileLoader + @ingroup Utilities + @pure + */ + virtual unsigned int getTriangleCount() = 0; + /*! + @memberof geometryFileLoader + @ingroup Utilities + @pure + */ + virtual bool getTriangle(ffw::vec3f* P0, ffw::vec3f* P1, ffw::vec3f* P2, ffw::vec3f* N0, ffw::vec3f* N1, ffw::vec3f* N2, ffw::vec2f* T0, ffw::vec2f* T1, ffw::vec2f* T2) = 0; + /*! + @memberof geometryFileLoader + @ingroup Utilities + */ + bool isOpen() const; + /*! + @memberof geometryFileLoader + @ingroup Utilities + */ + operator bool () const; + protected: + geometryFileLoader(const geometryFileLoader& Other) = default; + geometryFileLoader& operator = (const geometryFileLoader& Other) = default; + bool loaded; + }; + + /*! + @memberof ffw + @ingroup Utilities + */ + class FFW_API geometryFileSaver { + public: + geometryFileSaver(); + virtual ~geometryFileSaver(); + /*! + @memberof geometryFileSaver + @ingroup Utilities + @pure + */ + virtual bool open(const std::string& Path) = 0; + /*! + @memberof geometryFileSaver + @ingroup Utilities + @pure + */ + virtual bool open(const std::wstring& Path) = 0; + /*! + @memberof geometryFileSaver + @ingroup Utilities + @pure + */ + virtual void close() = 0; + /*! + @memberof geometryFileSaver + @ingroup Utilities + */ + bool isOpen() const; + /*! + @memberof geometryFileSaver + @ingroup Utilities + */ + operator bool () const; + protected: + geometryFileSaver(const geometryFileSaver& Other) = default; + geometryFileSaver& operator = (const geometryFileSaver& Other) = default; + bool loaded; + }; + + template class geometryLoader: public geometryFileLoader { + }; + + template class geometrySaver: public geometryFileSaver { + }; +}; +#endif + diff --git a/dependencies/FragmentFramework/include/fileLoaders/imageFile.hpp b/dependencies/FragmentFramework/include/fileLoaders/imageFile.hpp new file mode 100644 index 0000000..d1799f7 --- /dev/null +++ b/dependencies/FragmentFramework/include/fileLoaders/imageFile.hpp @@ -0,0 +1,201 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_LOAD_SAVE_IMAGE +#define FFW_LOAD_SAVE_IMAGE + +#include "../config.h" +#include "../utilities/fileUtilities.hpp" +#include + +/*! + @ingroup Utilities +*/ +namespace ffw{ + /*! + @memberof ffw + @ingroup Utilities + */ + class FFW_API imageFileLoader { + public: + imageFileLoader(); + virtual ~imageFileLoader(); + /*! + @memberof imageFileLoader + @ingroup Utilities + @pure + */ + virtual bool open(const std::string& Path) = 0; + /*! + @memberof imageFileLoader + @ingroup Utilities + @pure + */ + virtual bool open(const std::wstring& Path) = 0; + /*! + @memberof imageFileLoader + @ingroup Utilities + @pure + */ + virtual void close() = 0; + /*! + @memberof imageFileLoader + @ingroup Utilities + @pure + */ + virtual bool readRow(unsigned char* Pixels) = 0; + /*! + @memberof imageFileLoader + @ingroup Utilities + */ + int getRowOffset() const; + /*! + @memberof imageFileLoader + @ingroup Utilities + */ + bool isOpend() const; + /*! + @memberof imageFileLoader + @ingroup Utilities + */ + int getWidth() const; + /*! + @memberof imageFileLoader + @ingroup Utilities + */ + int getHeight() const; + /*! + @memberof imageFileLoader + @ingroup Utilities + */ + imageType getImageType() const; + /*! + @memberof imageFileLoader + @ingroup Utilities + */ + int getBithDepth() const; + /*! + @memberof imageFileLoader + @ingroup Utilities + */ + int getNumOfChannels() const; + /*! + @memberof imageFileLoader + @ingroup Utilities + */ + operator bool() const; + + protected: + imageFileLoader(const imageFileLoader& Other) = default; + imageFileLoader& operator = (const imageFileLoader& Other) = default; + bool loaded; + int rows; + int width; + int height; + int channels; + int bitDepth; + imageType type; + }; + + /*! + @memberof ffw + @ingroup Utilities + */ + class FFW_API imageFileSaver { + public: + imageFileSaver(); + virtual ~imageFileSaver(); + /*! + @memberof imageFileSaver + @ingroup Utilities + @pure + */ + virtual bool open(const std::string& Path, int Width, int Height, imageType Type) = 0; + /*! + @memberof imageFileSaver + @ingroup Utilities + @pure + */ + virtual bool open(const std::wstring& Path, int Width, int Height, imageType Type) = 0; + /*! + @memberof imageFileSaver + @ingroup Utilities + @pure + */ + virtual void close() = 0; + /*! + @memberof imageFileSaver + @pureer + @ingroup Utilities + */ + virtual bool writeRow(unsigned char* Pixels) = 0; + /*! + @memberof imageFileSaver + @ingroup Utilities + @pure + */ + virtual bool writeFooter() = 0; + /*! + @memberof imageFileSaver + @ingroup Utilities + */ + int getRowOffset() const; + /*! + @memberof imageFileSaver + @ingroup Utilities + */ + bool isOpend() const; + /*! + @memberof imageFileSaver + @ingroup Utilities + */ + int getWidth() const; + /*! + @memberof imageFileSaver + @ingroup Utilities + */ + int getHeight() const; + /*! + @memberof imageFileSaver + @ingroup Utilities + */ + imageType getImageType() const; + /*! + @memberof imageFileSaver + @ingroup Utilities + */ + int getBithDepth() const; + /*! + @memberof imageFileSaver + @ingroup Utilities + */ + int getNumOfChannels() const; + /*! + @memberof imageFileSaver + @ingroup Utilities + */ + operator bool() const; + + protected: + imageFileSaver(const imageFileSaver& Other) = default; + imageFileSaver& operator = (const imageFileSaver& Other) = default; + bool loaded; + int width; + int height; + int rows; + int channels; + int bitDepth; + imageType type; + }; + + template class imageLoader: public imageFileLoader { + }; + + template class imageSaver: public imageFileSaver { + }; +}; +#endif + diff --git a/dependencies/FragmentFramework/include/fileLoaders/jpgFile.hpp b/dependencies/FragmentFramework/include/fileLoaders/jpgFile.hpp new file mode 100644 index 0000000..173231d --- /dev/null +++ b/dependencies/FragmentFramework/include/fileLoaders/jpgFile.hpp @@ -0,0 +1,140 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_LOAD_SAVE_JPG +#define FFW_LOAD_SAVE_JPG + +#include "imageFile.hpp" + +/*! + @ingroup Utilities +*/ +namespace ffw{ + class jpgFile{}; + /*! + @memberof ffw + @ingroup Utilities + @sa imageFileLoader + @inherit imageFileLoader + */ + template <> class FFW_API imageLoader: public imageFileLoader { + public: + imageLoader(); + /*! + @memberof imageLoader + @ingroup Utilities + */ + imageLoader(imageLoader&& Other); + ~imageLoader(); + /*! + @memberof imageLoader + @ingroup Utilities + */ + bool open(const std::string& Path) override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + bool open(const std::wstring& Path) override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + void close() override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + bool readRow(unsigned char* Pixels) override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + imageLoader& operator = (imageLoader&& Other); + // Copy constructor is not allowed + imageLoader(const imageLoader& Other) = delete; + // Copy assigment is not allowed + imageLoader& operator = (const imageLoader& Other) = delete; + + private: + class impl; + impl* pimpl; + }; + + /*! + @memberof ffw + @ingroup Utilities + */ + template <> class FFW_API imageSaver: public imageFileSaver { + public: + imageSaver(); + /*! + @memberof imageSaver + @ingroup Utilities + */ + imageSaver(imageSaver&& Other); + ~imageSaver(); + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool open(const std::string& Path, int Width, int Height, imageType Type) override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool open(const std::wstring& Path, int Width, int Height, imageType Type) override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + void close() override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool writeRow(unsigned char* Pixels) override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool writeFooter() override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + imageSaver& operator = (imageSaver&& Other); + // Copy constructor is not allowed + imageSaver(const imageSaver& Other) = delete; + // Copy assigment is not allowed + imageSaver& operator = (const imageSaver& Other) = delete; + + private: + class impl; + impl* pimpl; + }; + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API loadJPG(const std::string& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API saveJPG(const std::string& Path, unsigned char* Pixels, int Width, int Height, imageType Type); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API loadJPG(const std::wstring& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API saveJPG(const std::wstring& Path, unsigned char* Pixels, int Width, int Height, imageType Type); +}; +#endif diff --git a/third-party-libs/FragmentFramework/include/utilities/loadSaveJson.h b/dependencies/FragmentFramework/include/fileLoaders/jsonFile.hpp similarity index 98% rename from third-party-libs/FragmentFramework/include/utilities/loadSaveJson.h rename to dependencies/FragmentFramework/include/fileLoaders/jsonFile.hpp index eeccc05..6958c1b 100644 --- a/third-party-libs/FragmentFramework/include/utilities/loadSaveJson.h +++ b/dependencies/FragmentFramework/include/fileLoaders/jsonFile.hpp @@ -7,7 +7,7 @@ #ifndef FFW_LOAD_SAVE_JSON #define FFW_LOAD_SAVE_JSON -#include "../dll.h" +#include "../config.h" #include #include "../math/math.h" diff --git a/dependencies/FragmentFramework/include/fileLoaders/objFile.hpp b/dependencies/FragmentFramework/include/fileLoaders/objFile.hpp new file mode 100644 index 0000000..07f1760 --- /dev/null +++ b/dependencies/FragmentFramework/include/fileLoaders/objFile.hpp @@ -0,0 +1,115 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_LOAD_SAVE_OBJ +#define FFW_LOAD_SAVE_OBJ + +#include "geomFile.hpp" + +/*! + @ingroup Utilities +*/ +namespace ffw{ + class objFile{}; + /*! + @memberof ffw + @ingroup Utilities + */ + template <> class FFW_API geometryLoader: public geometryFileLoader { + public: + geometryLoader(); + /*! + @memberof geometryLoader + @ingroup Utilities + */ + geometryLoader(geometryLoader&& Other); + ~geometryLoader(); + /*! + @memberof geometryLoader + @ingroup Utilities + */ + bool open(const std::string& Path) override; + /*! + @memberof geometryLoader + @ingroup Utilities + */ + bool open(const std::wstring& Path) override; + /*! + @memberof geometryLoader + @ingroup Utilities + */ + void close() override; + /*! + @memberof geometryLoader + @ingroup Utilities + */ + bool eof() const override; + /*! + @memberof geometryLoader + @ingroup Utilities + */ + bool loadObject(unsigned int Index) override; + /*! + @memberof geometryLoader + @ingroup Utilities + */ + unsigned int getObjectCount() const override; + /*! + @memberof geometryLoader + @ingroup Utilities + */ + unsigned int hasObjectVertices(unsigned int Index) const override; + /*! + @memberof geometryLoader + @ingroup Utilities + */ + unsigned int hasObjectNormals(unsigned int Index) const override; + /*! + @memberof geometryLoader + @ingroup Utilities + */ + unsigned int hasObjectTexPos(unsigned int Index) const override; + /*! + @memberof geometryLoader + @ingroup Utilities + */ + const std::string& getObjectName(unsigned int Index) const override; + /*! + @memberof geometryLoader + @ingroup Utilities + */ + unsigned int getTriangleCount() override; + /*! + @memberof geometryLoader + @ingroup Utilities + */ + bool getTriangle(ffw::vec3f* P0, ffw::vec3f* P1, ffw::vec3f* P2, ffw::vec3f* N0, ffw::vec3f* N1, ffw::vec3f* N2, ffw::vec2f* T0, ffw::vec2f* T1, ffw::vec2f* T2) override; + /*! + @memberof geometryLoader + @ingroup Utilities + */ + geometryLoader& operator = (geometryLoader&& Other); + // Copy constructor is not allowed + geometryLoader(const geometryLoader& Other) = delete; + // Copy assigment is not allowed + geometryLoader& operator = (const geometryLoader& Other) = delete; + + private: + class impl; + impl* pimpl; + }; + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API loadOBJ(const std::string& Path, float** Vertices, unsigned int* NumVertices); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API loadOBJ(const std::wstring& Path, float** Vertices, unsigned int* NumVertices); +}; +#endif diff --git a/dependencies/FragmentFramework/include/fileLoaders/oggFile.hpp b/dependencies/FragmentFramework/include/fileLoaders/oggFile.hpp new file mode 100644 index 0000000..8ac2853 --- /dev/null +++ b/dependencies/FragmentFramework/include/fileLoaders/oggFile.hpp @@ -0,0 +1,178 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_LOAD_SAVE_OGG +#define FFW_LOAD_SAVE_OGG + +#include "audioFile.hpp" + +/*! + @ingroup Utilities +*/ +namespace ffw{ + class oggFile{}; + /*! + @memberof ffw + @ingroup Utilities + @sa audioFileLoader + @inherit audioFileLoader + */ + template<> class FFW_API audioLoader: public audioFileLoader { + public: + audioLoader(); + /*! + @memberof audioLoader + @ingroup Utilities + */ + audioLoader(audioLoader&& Other); + ~audioLoader(); + /*! + @memberof audioLoader + @ingroup Utilities + */ + bool open(const std::string& Path) override; + /*! + @memberof audioLoader + @ingroup Utilities + */ + bool open(const std::wstring& Path) override; + /*! + @memberof audioLoader + @ingroup Utilities + */ + void close() override; + /*! + @memberof audioLoader + @ingroup Utilities + */ + bool readChunk(unsigned char* Bytes, size_t* BytesOut) override; + /*! + @memberof audioLoader + @ingroup Utilities + @pure + */ + bool skipChunk(size_t* BytesOut) override; + /*! + @memberof audioLoader + @ingroup Utilities + @pure + */ + bool reset() override; + /*! + @memberof audioLoader + @ingroup Utilities + @pure + */ + bool eof() override; + /*! + @memberof audioLoader + @ingroup Utilities + */ + size_t getPos() override; + /*! + @memberof audioLoader + @ingroup Utilities + */ + audioLoader& operator = (audioLoader&& Other); + // Copy constructor is not allowed + audioLoader(const audioLoader& Other) = delete; + // Copy assigment is not allowed + audioLoader& operator = (const audioLoader& Other) = delete; + + private: + class impl; + impl* pimpl; + }; + /*! + @memberof ffw + @ingroup Utilities + @sa audioFileLoader + @inherit audioFileLoader + */ + template<> class FFW_API audioSaver: public audioFileSaver { + public: + audioSaver(); + /*! + @memberof audioSaver + @ingroup Utilities + */ + audioSaver(audioSaver&& Other); + ~audioSaver(); + /*! + @memberof audioSaver + @ingroup Utilities + */ + bool open(const std::string& Path, int BitsPerSample, size_t Size, int SampleRate, int NumChannels, int Kbps = 500) override; + /*! + @memberof audioSaver + @ingroup Utilities + */ + bool open(const std::wstring& Path, int BitsPerSample, size_t Size, int SampleRate, int NumChannels, int Kbps = 500) override; + /*! + @memberof audioSaver + @ingroup Utilities + */ + void close() override; + /*! + @memberof audioSaver + @ingroup Utilities + */ + bool writeChunk(unsigned char* Data, size_t* BytesWritten) override; + /*! + @memberof audioSaver + @ingroup Utilities + @pure + */ + bool writeFooter() override; + /*! + @memberof audioSaver + @ingroup Utilities + @pure + */ + bool eof() override; + /*! + @memberof audioSaver + @ingroup Utilities + */ + size_t getPos() override; + /*! + @memberof audioSaver + @ingroup Utilities + */ + audioSaver& operator = (audioSaver&& Other); + // Copy constructor is not allowed + audioSaver(const audioSaver& Other) = delete; + // Copy assigment is not allowed + audioSaver& operator = (const audioSaver& Other) = delete; + + private: + class impl; + impl* pimpl; + }; + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API loadOGG(const std::string& Path, unsigned char** Data, int* BitsPerSample, size_t* Size, int* SampleRate, int* NumChannels); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API saveOGG(const std::string& Path, unsigned char* Data, int BitsPerSample, size_t Size, int SampleRate, int NumChannels, int Kbps = 500); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API loadOGG(const std::wstring& Path, unsigned char** Data, int* BitsPerSample, size_t* Size, int* SampleRate, int* NumChannels); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API saveOGG(const std::wstring& Path, unsigned char* Data, int BitsPerSample, size_t Size, int SampleRate, int NumChannels, int Kbps = 500); +}; +#endif + + diff --git a/dependencies/FragmentFramework/include/fileLoaders/pbmFile.hpp b/dependencies/FragmentFramework/include/fileLoaders/pbmFile.hpp new file mode 100644 index 0000000..169e15a --- /dev/null +++ b/dependencies/FragmentFramework/include/fileLoaders/pbmFile.hpp @@ -0,0 +1,142 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_LOAD_SAVE_PBM +#define FFW_LOAD_SAVE_PBM + +#include "imageFile.hpp" + +/*! + @ingroup Utilities +*/ +namespace ffw{ + class pbmFile{}; + /*! + @memberof ffw + @ingroup Utilities + @sa imageFileLoader + @inherit imageFileLoader + */ + template<> class FFW_API imageLoader: public imageFileLoader { + public: + imageLoader(); + /*! + @memberof imageLoader + @ingroup Utilities + */ + imageLoader(imageLoader&& Other); + ~imageLoader(); + /*! + @memberof imageLoader + @ingroup Utilities + */ + bool open(const std::string& Path) override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + bool open(const std::wstring& Path) override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + void close() override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + bool readRow(unsigned char* Pixels) override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + imageLoader& operator = (imageLoader&& Other); + // Copy constructor is not allowed + imageLoader(const imageLoader& Other) = delete; + // Copy assigment is not allowed + imageLoader& operator = (const imageLoader& Other) = delete; + + private: + class impl; + impl* pimpl; + }; + + /*! + @memberof ffw + @ingroup Utilities + @sa imageFileSaver + @inherit imageFileSaver + */ + template<> class FFW_API imageSaver: public imageFileSaver { + public: + imageSaver(); + /*! + @memberof imageSaver + @ingroup Utilities + */ + imageSaver(imageSaver&& Other); + ~imageSaver(); + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool open(const std::string& Path, int Width, int Height, imageType Type) override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool open(const std::wstring& Path, int Width, int Height, imageType Type) override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + void close() override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool writeRow(unsigned char* Pixels) override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool writeFooter() override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + imageSaver& operator = (imageSaver&& Other); + // Copy constructor is not allowed + imageSaver(const imageSaver& Other) = delete; + // Copy assigment is not allowed + imageSaver& operator = (const imageSaver& Other) = delete; + + private: + class impl; + impl* pimpl; + }; + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API loadPBM(const std::string& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API savePBM(const std::string& Path, unsigned char* Pixels, int Width, int Height, imageType Type); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API loadPBM(const std::wstring& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API savePBM(const std::wstring& Path, unsigned char* Pixels, int Width, int Height, imageType Type); +}; +#endif diff --git a/dependencies/FragmentFramework/include/fileLoaders/pngFile.hpp b/dependencies/FragmentFramework/include/fileLoaders/pngFile.hpp new file mode 100644 index 0000000..679860b --- /dev/null +++ b/dependencies/FragmentFramework/include/fileLoaders/pngFile.hpp @@ -0,0 +1,143 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_LOAD_SAVE_PNG +#define FFW_LOAD_SAVE_PNG + +#include "imageFile.hpp" + +/*! + @ingroup Utilities +*/ +namespace ffw{ + class pngFile{}; + /*! + @memberof ffw + @ingroup Utilities + @sa imageFileLoader + @inherit imageFileLoader + */ + template <> class FFW_API imageLoader: public imageFileLoader { + public: + imageLoader(); + /*! + @memberof imageLoader + @ingroup Utilities + */ + imageLoader(imageLoader&& Other); + ~imageLoader(); + /*! + @memberof imageLoader + @ingroup Utilities + */ + bool open(const std::string& Path) override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + bool open(const std::wstring& Path) override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + void close() override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + bool readRow(unsigned char* Pixels) override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + imageLoader& operator = (imageLoader&& Other); + // Copy constructor is not allowed + imageLoader(const imageLoader& Other) = delete; + // Copy assigment is not allowed + imageLoader& operator = (const imageLoader& Other) = delete; + + private: + class impl; + impl* pimpl; + }; + /*! + @memberof ffw + @ingroup Utilities + @sa imageFileSaver + @inherit imageFileSaver + */ + template <> class FFW_API imageSaver: public imageFileSaver { + public: + imageSaver(); + /*! + @memberof imageSaver + @ingroup Utilities + */ + imageSaver(imageSaver&& Other); + ~imageSaver(); + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool open(const std::string& Path, int Width, int Height, imageType Type) override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool open(const std::wstring& Path, int Width, int Height, imageType Type) override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + void close() override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool writeRow(unsigned char* Pixels) override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool writeFooter() override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + imageSaver& operator = (imageSaver&& Other); + // Copy constructor is not allowed + imageSaver(const imageSaver& Other) = delete; + // Copy assigment is not allowed + imageSaver& operator = (const imageSaver& Other) = delete; + + private: + class impl; + impl* pimpl; + }; + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API loadPNG(const std::string& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API savePNG(const std::string& Path, unsigned char* Pixels, int Width, int Height, imageType Type); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API loadPNG(const std::wstring& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API savePNG(const std::wstring& Path, unsigned char* Pixels, int Width, int Height, imageType Type); +}; +#endif + + diff --git a/dependencies/FragmentFramework/include/fileLoaders/tgaFile.hpp b/dependencies/FragmentFramework/include/fileLoaders/tgaFile.hpp new file mode 100644 index 0000000..4c4a81c --- /dev/null +++ b/dependencies/FragmentFramework/include/fileLoaders/tgaFile.hpp @@ -0,0 +1,143 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_LOAD_SAVE_TGA +#define FFW_LOAD_SAVE_TGA + +#include "imageFile.hpp" + +/*! + @ingroup Utilities +*/ +namespace ffw{ + class tgaFile{}; + /*! + @memberof ffw + @ingroup Utilities + @sa imageFileLoader + @inherit imageFileLoader + */ + template <> class FFW_API imageLoader: public imageFileLoader { + public: + imageLoader(); + /*! + @memberof imageLoader + @ingroup Utilities + */ + imageLoader(imageLoader&& Other); + ~imageLoader(); + /*! + @memberof imageLoader + @ingroup Utilities + */ + bool open(const std::string& Path) override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + bool open(const std::wstring& Path) override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + void close() override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + bool readRow(unsigned char* Pixels) override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + imageLoader& operator = (imageLoader&& Other); + // Copy constructor is not allowed + imageLoader(const imageLoader& Other) = delete; + // Copy assigment is not allowed + imageLoader& operator = (const imageLoader& Other) = delete; + + private: + class impl; + impl* pimpl; + }; + + /*! + @memberof ffw + @ingroup Utilities + @sa imageFileSaver + @inherit imageFileSaver + */ + template <> class FFW_API imageSaver: public imageFileSaver { + public: + imageSaver(); + /*! + @memberof imageSaver + @ingroup Utilities + */ + imageSaver(imageSaver&& Other); + ~imageSaver(); + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool open(const std::string& Path, int Width, int Height, imageType Type) override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool open(const std::wstring& Path, int Width, int Height, imageType Type) override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + void close() override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool writeRow(unsigned char* Pixels) override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool writeFooter() override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + imageSaver& operator = (imageSaver&& Other); + // Copy constructor is not allowed + imageSaver(const imageSaver& Other) = delete; + // Copy assigment is not allowed + imageSaver& operator = (const imageSaver& Other) = delete; + + private: + class impl; + impl* pimpl; + }; + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API loadTGA(const std::string& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API saveTGA(const std::string& Path, unsigned char* Pixels, int Width, int Height, imageType Type); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API loadTGA(const std::wstring& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API saveTGA(const std::wstring& Path, unsigned char* Pixels, int Width, int Height, imageType Type); +}; +#endif + diff --git a/dependencies/FragmentFramework/include/fileLoaders/tiffFile.hpp b/dependencies/FragmentFramework/include/fileLoaders/tiffFile.hpp new file mode 100644 index 0000000..7366efb --- /dev/null +++ b/dependencies/FragmentFramework/include/fileLoaders/tiffFile.hpp @@ -0,0 +1,144 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_LOAD_SAVE_TIFF +#define FFW_LOAD_SAVE_TIFF + +#include "imageFile.hpp" + +/*! + @ingroup Utilities +*/ +namespace ffw{ + class tiffFile{}; + /*! + @memberof ffw + @ingroup Utilities + @sa imageFileLoader + @inherit imageFileLoader + */ + template <> class FFW_API imageLoader: public imageFileLoader { + public: + imageLoader(); + /*! + @memberof imageLoader + @ingroup Utilities + */ + imageLoader(imageLoader&& Other); + ~imageLoader(); + /*! + @memberof imageLoader + @ingroup Utilities + */ + bool open(const std::string& Path) override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + bool open(const std::wstring& Path) override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + void close() override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + bool readRow(unsigned char* Pixels) override; + /*! + @memberof imageLoader + @ingroup Utilities + */ + imageLoader& operator = (imageLoader&& Other); + // Copy constructor is not allowed + imageLoader(const imageLoader& Other) = delete; + // Copy assigment is not allowed + imageLoader& operator = (const imageLoader& Other) = delete; + + private: + class impl; + impl* pimpl; + }; + + /*! + @memberof ffw + @ingroup Utilities + @sa imageFileSaver + @inherit imageFileSaver + */ + template <> class FFW_API imageSaver: public imageFileSaver { + public: + imageSaver(); + /*! + @memberof imageSaver + @ingroup Utilities + */ + imageSaver(imageSaver&& Other); + ~imageSaver(); + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool open(const std::string& Path, int Width, int Height, imageType Type) override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool open(const std::wstring& Path, int Width, int Height, imageType Type) override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + void close() override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool writeRow(unsigned char* Pixels) override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + bool writeFooter() override; + /*! + @memberof imageSaver + @ingroup Utilities + */ + imageSaver& operator = (imageSaver&& Other); + // Copy constructor is not allowed + imageSaver(const imageSaver& Other) = delete; + // Copy assigment is not allowed + imageSaver& operator = (const imageSaver& Other) = delete; + + private: + class impl; + impl* pimpl; + }; + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API loadTIFF(const std::wstring& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API saveTIFF(const std::wstring& Path, unsigned char* Pixels, int Width, int Height, imageType Type); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API loadTIFF(const std::string& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API saveTIFF(const std::string& Path, unsigned char* Pixels, int Width, int Height, imageType Type); +}; +#endif + + diff --git a/third-party-libs/FragmentFramework/include/utilities/loadSaveTxt.h b/dependencies/FragmentFramework/include/fileLoaders/txtFile.hpp similarity index 98% rename from third-party-libs/FragmentFramework/include/utilities/loadSaveTxt.h rename to dependencies/FragmentFramework/include/fileLoaders/txtFile.hpp index 5c7640c..42a1af9 100644 --- a/third-party-libs/FragmentFramework/include/utilities/loadSaveTxt.h +++ b/dependencies/FragmentFramework/include/fileLoaders/txtFile.hpp @@ -7,7 +7,7 @@ #ifndef FFW_LOAD_SAVE_TXT #define FFW_LOAD_SAVE_TXT -#include "../dll.h" +#include "../config.h" #include #include diff --git a/dependencies/FragmentFramework/include/fileLoaders/wavFile.hpp b/dependencies/FragmentFramework/include/fileLoaders/wavFile.hpp new file mode 100644 index 0000000..b3189d7 --- /dev/null +++ b/dependencies/FragmentFramework/include/fileLoaders/wavFile.hpp @@ -0,0 +1,191 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_LOAD_SAVE_WAV +#define FFW_LOAD_SAVE_WAV + +#include "audioFile.hpp" + +/*! + @ingroup Utilities +*/ +namespace ffw{ + class wavFile{}; + /*! + @memberof ffw + @ingroup Utilities + @sa audioFileLoader + @inherit audioFileLoader + */ + template<> class FFW_API audioLoader: public audioFileLoader { + public: + audioLoader(); + /*! + @memberof audioLoader + @ingroup Utilities + */ + audioLoader(audioLoader&& Other); + ~audioLoader(); + /*! + @memberof audioLoader + @ingroup Utilities + */ + bool open(const std::string& Path) override; + /*! + @memberof audioLoader + @ingroup Utilities + */ + bool open(const std::wstring& Path) override; + /*! + @memberof audioLoader + @ingroup Utilities + */ + void close() override; + /*! + @memberof audioLoader + @ingroup Utilities + */ + bool readChunk(unsigned char* Data, size_t* BytesOut) override; + /*! + @memberof audioLoader + @ingroup Utilities + */ + bool skipChunk(size_t* BytesOut) override; + /*! + @memberof audioLoader + @ingroup Utilities + @pure + */ + bool reset() override; + /*! + @memberof audioLoader + @ingroup Utilities + @pure + */ + bool eof() override; + /*! + @memberof audioLoader + @ingroup Utilities + */ + size_t getPos() override; + /*! + @memberof audioLoader + @ingroup Utilities + */ + audioLoader& operator = (audioLoader&& Other); + // Copy constructor is not allowed + audioLoader(const audioLoader& Other) = delete; + // Copy assigment is not allowed + audioLoader& operator = (const audioLoader& Other) = delete; + + private: + class impl; + impl* pimpl; + }; + /*! + @memberof ffw + @ingroup Utilities + @sa audioFileLoader + @inherit audioFileLoader + */ + template<> class FFW_API audioSaver: public audioFileSaver { + public: + audioSaver(); + /*! + @memberof audioSaver + @ingroup Utilities + */ + audioSaver(audioSaver&& Other); + ~audioSaver(); + /*! + @memberof audioSaver + @ingroup Utilities + */ + bool open(const std::string& Path, int BitsPerSample, size_t Size, int SampleRate, int NumChannels, int Kbps = 500000) override; + /*! + @memberof audioSaver + @ingroup Utilities + */ + bool open(const std::wstring& Path, int BitsPerSample, size_t Size, int SampleRate, int NumChannels, int Kbps = 500000) override; + /*! + @memberof audioSaver + @ingroup Utilities + */ + void close() override; + /*! + @memberof audioSaver + @ingroup Utilities + */ + bool writeChunk(unsigned char* Data, size_t* BytesWritten) override; + /*! + @memberof audioSaver + @ingroup Utilities + @pure + */ + bool writeFooter() override; + /*! + @memberof audioSaver + @ingroup Utilities + @pure + */ + bool eof() override; + /*! + @memberof audioSaver + @ingroup Utilities + */ + size_t getPos() override; + /*! + @memberof audioSaver + @ingroup Utilities + */ + audioSaver& operator = (audioSaver&& Other); + // Copy constructor is not allowed + audioSaver(const audioSaver& Other) = delete; + // Copy assigment is not allowed + audioSaver& operator = (const audioSaver& Other) = delete; + + private: + class impl; + impl* pimpl; + }; + /*! + @memberof ffw + @ingroup Utilities + + @brief Loads WAV file + + @details Loads audio data from WAV file. RIFF formal only. + + @param [in] Path Path to file + @param [out] Data Where to store buffer + @param [out] BitsPerSample Where to store bits per sample + @param [out] Size Where to store total buffer size + @param [out] SampleRate Where to store sample rate (frequency) + @param [out] NumChannels Where to store number of channels + + @return True on success + + @see saveWAV() + */ + bool FFW_API loadWAV(const std::string& Path, unsigned char** Data, int* BitsPerSample, size_t* Size, int* SampleRate, int* NumChannels); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API saveWAV(const std::string& Path, unsigned char* Data, int BitsPerSample, size_t Size, int SampleRate, int NumChannels); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API loadWAV(const std::wstring& Path, unsigned char** Data, int* BitsPerSample, size_t* Size, int* SampleRate, int* NumChannels); + /*! + @memberof ffw + @ingroup Utilities + */ + bool FFW_API saveWAV(const std::wstring& Path, unsigned char* Data, int BitsPerSample, size_t Size, int SampleRate, int NumChannels); +}; + +#endif diff --git a/third-party-libs/FragmentFramework/include/utilities/loadSaveXml.h b/dependencies/FragmentFramework/include/fileLoaders/xmlFile.hpp similarity index 92% rename from third-party-libs/FragmentFramework/include/utilities/loadSaveXml.h rename to dependencies/FragmentFramework/include/fileLoaders/xmlFile.hpp index 61efbde..15c5bf1 100644 --- a/third-party-libs/FragmentFramework/include/utilities/loadSaveXml.h +++ b/dependencies/FragmentFramework/include/fileLoaders/xmlFile.hpp @@ -7,10 +7,8 @@ #ifndef FFW_LOAD_SAVE_XML #define FFW_LOAD_SAVE_XML -#include "../dll.h" -#include "../math/stringMath.h" -#include "../math/math.h" -#include "file.h" +#include "../config.h" +#include /*! @ingroup Utilities diff --git a/dependencies/FragmentFramework/include/gl/extensions.hpp b/dependencies/FragmentFramework/include/gl/extensions.hpp new file mode 100644 index 0000000..6d2f643 --- /dev/null +++ b/dependencies/FragmentFramework/include/gl/extensions.hpp @@ -0,0 +1,3337 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_GL_EXTENSIONS +#define FFW_GL_EXTENSIONS + +#include "../config.h" +#include +#include + +#if FFW_USE_GL_EXTENSIONS == 1 && GL_GLEXT_VERSION < 20150623 +#error Outdated glext.h! Expected version 20150623 or newer! +#endif + +namespace ffw{ + class glExtensions{ + public: + typedef void* (*glextLoader)(const char*); + + void init(glextLoader Loader); + + // Group GL_VERSION_1_2 + #if GL_VERSION_1_2 == 1 + PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements; + PFNGLTEXIMAGE3DPROC glTexImage3D; + PFNGLTEXSUBIMAGE3DPROC glTexSubImage3D; + PFNGLCOPYTEXSUBIMAGE3DPROC glCopyTexSubImage3D; + #endif + + // Group GL_VERSION_1_3 + #if GL_VERSION_1_3 == 1 + PFNGLACTIVETEXTUREPROC glActiveTexture; + PFNGLSAMPLECOVERAGEPROC glSampleCoverage; + PFNGLCOMPRESSEDTEXIMAGE3DPROC glCompressedTexImage3D; + PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2D; + PFNGLCOMPRESSEDTEXIMAGE1DPROC glCompressedTexImage1D; + PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glCompressedTexSubImage3D; + PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glCompressedTexSubImage2D; + PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glCompressedTexSubImage1D; + PFNGLGETCOMPRESSEDTEXIMAGEPROC glGetCompressedTexImage; + PFNGLCLIENTACTIVETEXTUREPROC glClientActiveTexture; + PFNGLMULTITEXCOORD1DPROC glMultiTexCoord1d; + PFNGLMULTITEXCOORD1DVPROC glMultiTexCoord1dv; + PFNGLMULTITEXCOORD1FPROC glMultiTexCoord1f; + PFNGLMULTITEXCOORD1FVPROC glMultiTexCoord1fv; + PFNGLMULTITEXCOORD1IPROC glMultiTexCoord1i; + PFNGLMULTITEXCOORD1IVPROC glMultiTexCoord1iv; + PFNGLMULTITEXCOORD1SPROC glMultiTexCoord1s; + PFNGLMULTITEXCOORD1SVPROC glMultiTexCoord1sv; + PFNGLMULTITEXCOORD2DPROC glMultiTexCoord2d; + PFNGLMULTITEXCOORD2DVPROC glMultiTexCoord2dv; + PFNGLMULTITEXCOORD2FPROC glMultiTexCoord2f; + PFNGLMULTITEXCOORD2FVPROC glMultiTexCoord2fv; + PFNGLMULTITEXCOORD2IPROC glMultiTexCoord2i; + PFNGLMULTITEXCOORD2IVPROC glMultiTexCoord2iv; + PFNGLMULTITEXCOORD2SPROC glMultiTexCoord2s; + PFNGLMULTITEXCOORD2SVPROC glMultiTexCoord2sv; + PFNGLMULTITEXCOORD3DPROC glMultiTexCoord3d; + PFNGLMULTITEXCOORD3DVPROC glMultiTexCoord3dv; + PFNGLMULTITEXCOORD3FPROC glMultiTexCoord3f; + PFNGLMULTITEXCOORD3FVPROC glMultiTexCoord3fv; + PFNGLMULTITEXCOORD3IPROC glMultiTexCoord3i; + PFNGLMULTITEXCOORD3IVPROC glMultiTexCoord3iv; + PFNGLMULTITEXCOORD3SPROC glMultiTexCoord3s; + PFNGLMULTITEXCOORD3SVPROC glMultiTexCoord3sv; + PFNGLMULTITEXCOORD4DPROC glMultiTexCoord4d; + PFNGLMULTITEXCOORD4DVPROC glMultiTexCoord4dv; + PFNGLMULTITEXCOORD4FPROC glMultiTexCoord4f; + PFNGLMULTITEXCOORD4FVPROC glMultiTexCoord4fv; + PFNGLMULTITEXCOORD4IPROC glMultiTexCoord4i; + PFNGLMULTITEXCOORD4IVPROC glMultiTexCoord4iv; + PFNGLMULTITEXCOORD4SPROC glMultiTexCoord4s; + PFNGLMULTITEXCOORD4SVPROC glMultiTexCoord4sv; + PFNGLLOADTRANSPOSEMATRIXFPROC glLoadTransposeMatrixf; + PFNGLLOADTRANSPOSEMATRIXDPROC glLoadTransposeMatrixd; + PFNGLMULTTRANSPOSEMATRIXFPROC glMultTransposeMatrixf; + PFNGLMULTTRANSPOSEMATRIXDPROC glMultTransposeMatrixd; + #endif + + // Group GL_VERSION_1_4 + #if GL_VERSION_1_4 == 1 + PFNGLBLENDFUNCSEPARATEPROC glBlendFuncSeparate; + PFNGLMULTIDRAWARRAYSPROC glMultiDrawArrays; + PFNGLMULTIDRAWELEMENTSPROC glMultiDrawElements; + PFNGLPOINTPARAMETERFPROC glPointParameterf; + PFNGLPOINTPARAMETERFVPROC glPointParameterfv; + PFNGLPOINTPARAMETERIPROC glPointParameteri; + PFNGLPOINTPARAMETERIVPROC glPointParameteriv; + PFNGLFOGCOORDFPROC glFogCoordf; + PFNGLFOGCOORDFVPROC glFogCoordfv; + PFNGLFOGCOORDDPROC glFogCoordd; + PFNGLFOGCOORDDVPROC glFogCoorddv; + PFNGLFOGCOORDPOINTERPROC glFogCoordPointer; + PFNGLSECONDARYCOLOR3BPROC glSecondaryColor3b; + PFNGLSECONDARYCOLOR3BVPROC glSecondaryColor3bv; + PFNGLSECONDARYCOLOR3DPROC glSecondaryColor3d; + PFNGLSECONDARYCOLOR3DVPROC glSecondaryColor3dv; + PFNGLSECONDARYCOLOR3FPROC glSecondaryColor3f; + PFNGLSECONDARYCOLOR3FVPROC glSecondaryColor3fv; + PFNGLSECONDARYCOLOR3IPROC glSecondaryColor3i; + PFNGLSECONDARYCOLOR3IVPROC glSecondaryColor3iv; + PFNGLSECONDARYCOLOR3SPROC glSecondaryColor3s; + PFNGLSECONDARYCOLOR3SVPROC glSecondaryColor3sv; + PFNGLSECONDARYCOLOR3UBPROC glSecondaryColor3ub; + PFNGLSECONDARYCOLOR3UBVPROC glSecondaryColor3ubv; + PFNGLSECONDARYCOLOR3UIPROC glSecondaryColor3ui; + PFNGLSECONDARYCOLOR3UIVPROC glSecondaryColor3uiv; + PFNGLSECONDARYCOLOR3USPROC glSecondaryColor3us; + PFNGLSECONDARYCOLOR3USVPROC glSecondaryColor3usv; + PFNGLSECONDARYCOLORPOINTERPROC glSecondaryColorPointer; + PFNGLWINDOWPOS2DPROC glWindowPos2d; + PFNGLWINDOWPOS2DVPROC glWindowPos2dv; + PFNGLWINDOWPOS2FPROC glWindowPos2f; + PFNGLWINDOWPOS2FVPROC glWindowPos2fv; + PFNGLWINDOWPOS2IPROC glWindowPos2i; + PFNGLWINDOWPOS2IVPROC glWindowPos2iv; + PFNGLWINDOWPOS2SPROC glWindowPos2s; + PFNGLWINDOWPOS2SVPROC glWindowPos2sv; + PFNGLWINDOWPOS3DPROC glWindowPos3d; + PFNGLWINDOWPOS3DVPROC glWindowPos3dv; + PFNGLWINDOWPOS3FPROC glWindowPos3f; + PFNGLWINDOWPOS3FVPROC glWindowPos3fv; + PFNGLWINDOWPOS3IPROC glWindowPos3i; + PFNGLWINDOWPOS3IVPROC glWindowPos3iv; + PFNGLWINDOWPOS3SPROC glWindowPos3s; + PFNGLWINDOWPOS3SVPROC glWindowPos3sv; + PFNGLBLENDCOLORPROC glBlendColor; + PFNGLBLENDEQUATIONPROC glBlendEquation; + #endif + + // Group GL_VERSION_1_5 + #if GL_VERSION_1_5 == 1 + PFNGLGENQUERIESPROC glGenQueries; + PFNGLDELETEQUERIESPROC glDeleteQueries; + PFNGLISQUERYPROC glIsQuery; + PFNGLBEGINQUERYPROC glBeginQuery; + PFNGLENDQUERYPROC glEndQuery; + PFNGLGETQUERYIVPROC glGetQueryiv; + PFNGLGETQUERYOBJECTIVPROC glGetQueryObjectiv; + PFNGLGETQUERYOBJECTUIVPROC glGetQueryObjectuiv; + PFNGLBINDBUFFERPROC glBindBuffer; + PFNGLDELETEBUFFERSPROC glDeleteBuffers; + PFNGLGENBUFFERSPROC glGenBuffers; + PFNGLISBUFFERPROC glIsBuffer; + PFNGLBUFFERDATAPROC glBufferData; + PFNGLBUFFERSUBDATAPROC glBufferSubData; + PFNGLGETBUFFERSUBDATAPROC glGetBufferSubData; + PFNGLMAPBUFFERPROC glMapBuffer; + PFNGLUNMAPBUFFERPROC glUnmapBuffer; + PFNGLGETBUFFERPARAMETERIVPROC glGetBufferParameteriv; + PFNGLGETBUFFERPOINTERVPROC glGetBufferPointerv; + #endif + + // Group GL_VERSION_2_0 + #if GL_VERSION_2_0 == 1 + PFNGLBLENDEQUATIONSEPARATEPROC glBlendEquationSeparate; + PFNGLDRAWBUFFERSPROC glDrawBuffers; + PFNGLSTENCILOPSEPARATEPROC glStencilOpSeparate; + PFNGLSTENCILFUNCSEPARATEPROC glStencilFuncSeparate; + PFNGLSTENCILMASKSEPARATEPROC glStencilMaskSeparate; + PFNGLATTACHSHADERPROC glAttachShader; + PFNGLBINDATTRIBLOCATIONPROC glBindAttribLocation; + PFNGLCOMPILESHADERPROC glCompileShader; + PFNGLCREATEPROGRAMPROC glCreateProgram; + PFNGLCREATESHADERPROC glCreateShader; + PFNGLDELETEPROGRAMPROC glDeleteProgram; + PFNGLDELETESHADERPROC glDeleteShader; + PFNGLDETACHSHADERPROC glDetachShader; + PFNGLDISABLEVERTEXATTRIBARRAYPROC glDisableVertexAttribArray; + PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray; + PFNGLGETACTIVEATTRIBPROC glGetActiveAttrib; + PFNGLGETACTIVEUNIFORMPROC glGetActiveUniform; + PFNGLGETATTACHEDSHADERSPROC glGetAttachedShaders; + PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation; + PFNGLGETPROGRAMIVPROC glGetProgramiv; + PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog; + PFNGLGETSHADERIVPROC glGetShaderiv; + PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog; + PFNGLGETSHADERSOURCEPROC glGetShaderSource; + PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation; + PFNGLGETUNIFORMFVPROC glGetUniformfv; + PFNGLGETUNIFORMIVPROC glGetUniformiv; + PFNGLGETVERTEXATTRIBDVPROC glGetVertexAttribdv; + PFNGLGETVERTEXATTRIBFVPROC glGetVertexAttribfv; + PFNGLGETVERTEXATTRIBIVPROC glGetVertexAttribiv; + PFNGLGETVERTEXATTRIBPOINTERVPROC glGetVertexAttribPointerv; + PFNGLISPROGRAMPROC glIsProgram; + PFNGLISSHADERPROC glIsShader; + PFNGLLINKPROGRAMPROC glLinkProgram; + PFNGLSHADERSOURCEPROC glShaderSource; + PFNGLUSEPROGRAMPROC glUseProgram; + PFNGLUNIFORM1FPROC glUniform1f; + PFNGLUNIFORM2FPROC glUniform2f; + PFNGLUNIFORM3FPROC glUniform3f; + PFNGLUNIFORM4FPROC glUniform4f; + PFNGLUNIFORM1IPROC glUniform1i; + PFNGLUNIFORM2IPROC glUniform2i; + PFNGLUNIFORM3IPROC glUniform3i; + PFNGLUNIFORM4IPROC glUniform4i; + PFNGLUNIFORM1FVPROC glUniform1fv; + PFNGLUNIFORM2FVPROC glUniform2fv; + PFNGLUNIFORM3FVPROC glUniform3fv; + PFNGLUNIFORM4FVPROC glUniform4fv; + PFNGLUNIFORM1IVPROC glUniform1iv; + PFNGLUNIFORM2IVPROC glUniform2iv; + PFNGLUNIFORM3IVPROC glUniform3iv; + PFNGLUNIFORM4IVPROC glUniform4iv; + PFNGLUNIFORMMATRIX2FVPROC glUniformMatrix2fv; + PFNGLUNIFORMMATRIX3FVPROC glUniformMatrix3fv; + PFNGLUNIFORMMATRIX4FVPROC glUniformMatrix4fv; + PFNGLVALIDATEPROGRAMPROC glValidateProgram; + PFNGLVERTEXATTRIB1DPROC glVertexAttrib1d; + PFNGLVERTEXATTRIB1DVPROC glVertexAttrib1dv; + PFNGLVERTEXATTRIB1FPROC glVertexAttrib1f; + PFNGLVERTEXATTRIB1FVPROC glVertexAttrib1fv; + PFNGLVERTEXATTRIB1SPROC glVertexAttrib1s; + PFNGLVERTEXATTRIB1SVPROC glVertexAttrib1sv; + PFNGLVERTEXATTRIB2DPROC glVertexAttrib2d; + PFNGLVERTEXATTRIB2DVPROC glVertexAttrib2dv; + PFNGLVERTEXATTRIB2FPROC glVertexAttrib2f; + PFNGLVERTEXATTRIB2FVPROC glVertexAttrib2fv; + PFNGLVERTEXATTRIB2SPROC glVertexAttrib2s; + PFNGLVERTEXATTRIB2SVPROC glVertexAttrib2sv; + PFNGLVERTEXATTRIB3DPROC glVertexAttrib3d; + PFNGLVERTEXATTRIB3DVPROC glVertexAttrib3dv; + PFNGLVERTEXATTRIB3FPROC glVertexAttrib3f; + PFNGLVERTEXATTRIB3FVPROC glVertexAttrib3fv; + PFNGLVERTEXATTRIB3SPROC glVertexAttrib3s; + PFNGLVERTEXATTRIB3SVPROC glVertexAttrib3sv; + PFNGLVERTEXATTRIB4NBVPROC glVertexAttrib4Nbv; + PFNGLVERTEXATTRIB4NIVPROC glVertexAttrib4Niv; + PFNGLVERTEXATTRIB4NSVPROC glVertexAttrib4Nsv; + PFNGLVERTEXATTRIB4NUBPROC glVertexAttrib4Nub; + PFNGLVERTEXATTRIB4NUBVPROC glVertexAttrib4Nubv; + PFNGLVERTEXATTRIB4NUIVPROC glVertexAttrib4Nuiv; + PFNGLVERTEXATTRIB4NUSVPROC glVertexAttrib4Nusv; + PFNGLVERTEXATTRIB4BVPROC glVertexAttrib4bv; + PFNGLVERTEXATTRIB4DPROC glVertexAttrib4d; + PFNGLVERTEXATTRIB4DVPROC glVertexAttrib4dv; + PFNGLVERTEXATTRIB4FPROC glVertexAttrib4f; + PFNGLVERTEXATTRIB4FVPROC glVertexAttrib4fv; + PFNGLVERTEXATTRIB4IVPROC glVertexAttrib4iv; + PFNGLVERTEXATTRIB4SPROC glVertexAttrib4s; + PFNGLVERTEXATTRIB4SVPROC glVertexAttrib4sv; + PFNGLVERTEXATTRIB4UBVPROC glVertexAttrib4ubv; + PFNGLVERTEXATTRIB4UIVPROC glVertexAttrib4uiv; + PFNGLVERTEXATTRIB4USVPROC glVertexAttrib4usv; + PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer; + #endif + + // Group GL_VERSION_2_1 + #if GL_VERSION_2_1 == 1 + PFNGLUNIFORMMATRIX2X3FVPROC glUniformMatrix2x3fv; + PFNGLUNIFORMMATRIX3X2FVPROC glUniformMatrix3x2fv; + PFNGLUNIFORMMATRIX2X4FVPROC glUniformMatrix2x4fv; + PFNGLUNIFORMMATRIX4X2FVPROC glUniformMatrix4x2fv; + PFNGLUNIFORMMATRIX3X4FVPROC glUniformMatrix3x4fv; + PFNGLUNIFORMMATRIX4X3FVPROC glUniformMatrix4x3fv; + #endif + + // Group GL_VERSION_3_0 + #if GL_VERSION_3_0 == 1 + PFNGLCOLORMASKIPROC glColorMaski; + PFNGLGETBOOLEANI_VPROC glGetBooleani_v; + PFNGLGETINTEGERI_VPROC glGetIntegeri_v; + PFNGLENABLEIPROC glEnablei; + PFNGLDISABLEIPROC glDisablei; + PFNGLISENABLEDIPROC glIsEnabledi; + PFNGLBEGINTRANSFORMFEEDBACKPROC glBeginTransformFeedback; + PFNGLENDTRANSFORMFEEDBACKPROC glEndTransformFeedback; + PFNGLBINDBUFFERRANGEPROC glBindBufferRange; + PFNGLBINDBUFFERBASEPROC glBindBufferBase; + PFNGLTRANSFORMFEEDBACKVARYINGSPROC glTransformFeedbackVaryings; + PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glGetTransformFeedbackVarying; + PFNGLCLAMPCOLORPROC glClampColor; + PFNGLBEGINCONDITIONALRENDERPROC glBeginConditionalRender; + PFNGLENDCONDITIONALRENDERPROC glEndConditionalRender; + PFNGLVERTEXATTRIBIPOINTERPROC glVertexAttribIPointer; + PFNGLGETVERTEXATTRIBIIVPROC glGetVertexAttribIiv; + PFNGLGETVERTEXATTRIBIUIVPROC glGetVertexAttribIuiv; + PFNGLVERTEXATTRIBI1IPROC glVertexAttribI1i; + PFNGLVERTEXATTRIBI2IPROC glVertexAttribI2i; + PFNGLVERTEXATTRIBI3IPROC glVertexAttribI3i; + PFNGLVERTEXATTRIBI4IPROC glVertexAttribI4i; + PFNGLVERTEXATTRIBI1UIPROC glVertexAttribI1ui; + PFNGLVERTEXATTRIBI2UIPROC glVertexAttribI2ui; + PFNGLVERTEXATTRIBI3UIPROC glVertexAttribI3ui; + PFNGLVERTEXATTRIBI4UIPROC glVertexAttribI4ui; + PFNGLVERTEXATTRIBI1IVPROC glVertexAttribI1iv; + PFNGLVERTEXATTRIBI2IVPROC glVertexAttribI2iv; + PFNGLVERTEXATTRIBI3IVPROC glVertexAttribI3iv; + PFNGLVERTEXATTRIBI4IVPROC glVertexAttribI4iv; + PFNGLVERTEXATTRIBI1UIVPROC glVertexAttribI1uiv; + PFNGLVERTEXATTRIBI2UIVPROC glVertexAttribI2uiv; + PFNGLVERTEXATTRIBI3UIVPROC glVertexAttribI3uiv; + PFNGLVERTEXATTRIBI4UIVPROC glVertexAttribI4uiv; + PFNGLVERTEXATTRIBI4BVPROC glVertexAttribI4bv; + PFNGLVERTEXATTRIBI4SVPROC glVertexAttribI4sv; + PFNGLVERTEXATTRIBI4UBVPROC glVertexAttribI4ubv; + PFNGLVERTEXATTRIBI4USVPROC glVertexAttribI4usv; + PFNGLGETUNIFORMUIVPROC glGetUniformuiv; + PFNGLBINDFRAGDATALOCATIONPROC glBindFragDataLocation; + PFNGLGETFRAGDATALOCATIONPROC glGetFragDataLocation; + PFNGLUNIFORM1UIPROC glUniform1ui; + PFNGLUNIFORM2UIPROC glUniform2ui; + PFNGLUNIFORM3UIPROC glUniform3ui; + PFNGLUNIFORM4UIPROC glUniform4ui; + PFNGLUNIFORM1UIVPROC glUniform1uiv; + PFNGLUNIFORM2UIVPROC glUniform2uiv; + PFNGLUNIFORM3UIVPROC glUniform3uiv; + PFNGLUNIFORM4UIVPROC glUniform4uiv; + PFNGLTEXPARAMETERIIVPROC glTexParameterIiv; + PFNGLTEXPARAMETERIUIVPROC glTexParameterIuiv; + PFNGLGETTEXPARAMETERIIVPROC glGetTexParameterIiv; + PFNGLGETTEXPARAMETERIUIVPROC glGetTexParameterIuiv; + PFNGLCLEARBUFFERIVPROC glClearBufferiv; + PFNGLCLEARBUFFERUIVPROC glClearBufferuiv; + PFNGLCLEARBUFFERFVPROC glClearBufferfv; + PFNGLCLEARBUFFERFIPROC glClearBufferfi; + PFNGLGETSTRINGIPROC glGetStringi; + PFNGLISRENDERBUFFERPROC glIsRenderbuffer; + PFNGLBINDRENDERBUFFERPROC glBindRenderbuffer; + PFNGLDELETERENDERBUFFERSPROC glDeleteRenderbuffers; + PFNGLGENRENDERBUFFERSPROC glGenRenderbuffers; + PFNGLRENDERBUFFERSTORAGEPROC glRenderbufferStorage; + PFNGLGETRENDERBUFFERPARAMETERIVPROC glGetRenderbufferParameteriv; + PFNGLISFRAMEBUFFERPROC glIsFramebuffer; + PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer; + PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers; + PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers; + PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus; + PFNGLFRAMEBUFFERTEXTURE1DPROC glFramebufferTexture1D; + PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D; + PFNGLFRAMEBUFFERTEXTURE3DPROC glFramebufferTexture3D; + PFNGLFRAMEBUFFERRENDERBUFFERPROC glFramebufferRenderbuffer; + PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glGetFramebufferAttachmentParameteriv; + PFNGLGENERATEMIPMAPPROC glGenerateMipmap; + PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer; + PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glRenderbufferStorageMultisample; + PFNGLFRAMEBUFFERTEXTURELAYERPROC glFramebufferTextureLayer; + PFNGLMAPBUFFERRANGEPROC glMapBufferRange; + PFNGLFLUSHMAPPEDBUFFERRANGEPROC glFlushMappedBufferRange; + PFNGLBINDVERTEXARRAYPROC glBindVertexArray; + PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays; + PFNGLGENVERTEXARRAYSPROC glGenVertexArrays; + PFNGLISVERTEXARRAYPROC glIsVertexArray; + #endif + + // Group GL_VERSION_3_1 + #if GL_VERSION_3_1 == 1 + PFNGLDRAWARRAYSINSTANCEDPROC glDrawArraysInstanced; + PFNGLDRAWELEMENTSINSTANCEDPROC glDrawElementsInstanced; + PFNGLTEXBUFFERPROC glTexBuffer; + PFNGLPRIMITIVERESTARTINDEXPROC glPrimitiveRestartIndex; + PFNGLCOPYBUFFERSUBDATAPROC glCopyBufferSubData; + PFNGLGETUNIFORMINDICESPROC glGetUniformIndices; + PFNGLGETACTIVEUNIFORMSIVPROC glGetActiveUniformsiv; + PFNGLGETACTIVEUNIFORMNAMEPROC glGetActiveUniformName; + PFNGLGETUNIFORMBLOCKINDEXPROC glGetUniformBlockIndex; + PFNGLGETACTIVEUNIFORMBLOCKIVPROC glGetActiveUniformBlockiv; + PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glGetActiveUniformBlockName; + PFNGLUNIFORMBLOCKBINDINGPROC glUniformBlockBinding; + #endif + + // Group GL_VERSION_3_3 + #if GL_VERSION_3_3 == 1 + PFNGLBINDFRAGDATALOCATIONINDEXEDPROC glBindFragDataLocationIndexed; + PFNGLGETFRAGDATAINDEXPROC glGetFragDataIndex; + PFNGLGENSAMPLERSPROC glGenSamplers; + PFNGLDELETESAMPLERSPROC glDeleteSamplers; + PFNGLISSAMPLERPROC glIsSampler; + PFNGLBINDSAMPLERPROC glBindSampler; + PFNGLSAMPLERPARAMETERIPROC glSamplerParameteri; + PFNGLSAMPLERPARAMETERIVPROC glSamplerParameteriv; + PFNGLSAMPLERPARAMETERFPROC glSamplerParameterf; + PFNGLSAMPLERPARAMETERFVPROC glSamplerParameterfv; + PFNGLSAMPLERPARAMETERIIVPROC glSamplerParameterIiv; + PFNGLSAMPLERPARAMETERIUIVPROC glSamplerParameterIuiv; + PFNGLGETSAMPLERPARAMETERIVPROC glGetSamplerParameteriv; + PFNGLGETSAMPLERPARAMETERIIVPROC glGetSamplerParameterIiv; + PFNGLGETSAMPLERPARAMETERFVPROC glGetSamplerParameterfv; + PFNGLGETSAMPLERPARAMETERIUIVPROC glGetSamplerParameterIuiv; + PFNGLQUERYCOUNTERPROC glQueryCounter; + PFNGLGETQUERYOBJECTI64VPROC glGetQueryObjecti64v; + PFNGLGETQUERYOBJECTUI64VPROC glGetQueryObjectui64v; + PFNGLVERTEXATTRIBDIVISORPROC glVertexAttribDivisor; + PFNGLVERTEXATTRIBP1UIPROC glVertexAttribP1ui; + PFNGLVERTEXATTRIBP1UIVPROC glVertexAttribP1uiv; + PFNGLVERTEXATTRIBP2UIPROC glVertexAttribP2ui; + PFNGLVERTEXATTRIBP2UIVPROC glVertexAttribP2uiv; + PFNGLVERTEXATTRIBP3UIPROC glVertexAttribP3ui; + PFNGLVERTEXATTRIBP3UIVPROC glVertexAttribP3uiv; + PFNGLVERTEXATTRIBP4UIPROC glVertexAttribP4ui; + PFNGLVERTEXATTRIBP4UIVPROC glVertexAttribP4uiv; + PFNGLVERTEXP2UIPROC glVertexP2ui; + PFNGLVERTEXP2UIVPROC glVertexP2uiv; + PFNGLVERTEXP3UIPROC glVertexP3ui; + PFNGLVERTEXP3UIVPROC glVertexP3uiv; + PFNGLVERTEXP4UIPROC glVertexP4ui; + PFNGLVERTEXP4UIVPROC glVertexP4uiv; + PFNGLTEXCOORDP1UIPROC glTexCoordP1ui; + PFNGLTEXCOORDP1UIVPROC glTexCoordP1uiv; + PFNGLTEXCOORDP2UIPROC glTexCoordP2ui; + PFNGLTEXCOORDP2UIVPROC glTexCoordP2uiv; + PFNGLTEXCOORDP3UIPROC glTexCoordP3ui; + PFNGLTEXCOORDP3UIVPROC glTexCoordP3uiv; + PFNGLTEXCOORDP4UIPROC glTexCoordP4ui; + PFNGLTEXCOORDP4UIVPROC glTexCoordP4uiv; + PFNGLMULTITEXCOORDP1UIPROC glMultiTexCoordP1ui; + PFNGLMULTITEXCOORDP1UIVPROC glMultiTexCoordP1uiv; + PFNGLMULTITEXCOORDP2UIPROC glMultiTexCoordP2ui; + PFNGLMULTITEXCOORDP2UIVPROC glMultiTexCoordP2uiv; + PFNGLMULTITEXCOORDP3UIPROC glMultiTexCoordP3ui; + PFNGLMULTITEXCOORDP3UIVPROC glMultiTexCoordP3uiv; + PFNGLMULTITEXCOORDP4UIPROC glMultiTexCoordP4ui; + PFNGLMULTITEXCOORDP4UIVPROC glMultiTexCoordP4uiv; + PFNGLNORMALP3UIPROC glNormalP3ui; + PFNGLNORMALP3UIVPROC glNormalP3uiv; + PFNGLCOLORP3UIPROC glColorP3ui; + PFNGLCOLORP3UIVPROC glColorP3uiv; + PFNGLCOLORP4UIPROC glColorP4ui; + PFNGLCOLORP4UIVPROC glColorP4uiv; + PFNGLSECONDARYCOLORP3UIPROC glSecondaryColorP3ui; + PFNGLSECONDARYCOLORP3UIVPROC glSecondaryColorP3uiv; + #endif + + // Group GL_VERSION_4_0 + #if GL_VERSION_4_0 == 1 + PFNGLMINSAMPLESHADINGPROC glMinSampleShading; + PFNGLBLENDEQUATIONIPROC glBlendEquationi; + PFNGLBLENDEQUATIONSEPARATEIPROC glBlendEquationSeparatei; + PFNGLBLENDFUNCIPROC glBlendFunci; + PFNGLBLENDFUNCSEPARATEIPROC glBlendFuncSeparatei; + PFNGLDRAWARRAYSINDIRECTPROC glDrawArraysIndirect; + PFNGLDRAWELEMENTSINDIRECTPROC glDrawElementsIndirect; + PFNGLUNIFORM1DPROC glUniform1d; + PFNGLUNIFORM2DPROC glUniform2d; + PFNGLUNIFORM3DPROC glUniform3d; + PFNGLUNIFORM4DPROC glUniform4d; + PFNGLUNIFORM1DVPROC glUniform1dv; + PFNGLUNIFORM2DVPROC glUniform2dv; + PFNGLUNIFORM3DVPROC glUniform3dv; + PFNGLUNIFORM4DVPROC glUniform4dv; + PFNGLUNIFORMMATRIX2DVPROC glUniformMatrix2dv; + PFNGLUNIFORMMATRIX3DVPROC glUniformMatrix3dv; + PFNGLUNIFORMMATRIX4DVPROC glUniformMatrix4dv; + PFNGLUNIFORMMATRIX2X3DVPROC glUniformMatrix2x3dv; + PFNGLUNIFORMMATRIX2X4DVPROC glUniformMatrix2x4dv; + PFNGLUNIFORMMATRIX3X2DVPROC glUniformMatrix3x2dv; + PFNGLUNIFORMMATRIX3X4DVPROC glUniformMatrix3x4dv; + PFNGLUNIFORMMATRIX4X2DVPROC glUniformMatrix4x2dv; + PFNGLUNIFORMMATRIX4X3DVPROC glUniformMatrix4x3dv; + PFNGLGETUNIFORMDVPROC glGetUniformdv; + PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC glGetSubroutineUniformLocation; + PFNGLGETSUBROUTINEINDEXPROC glGetSubroutineIndex; + PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC glGetActiveSubroutineUniformiv; + PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC glGetActiveSubroutineUniformName; + PFNGLGETACTIVESUBROUTINENAMEPROC glGetActiveSubroutineName; + PFNGLUNIFORMSUBROUTINESUIVPROC glUniformSubroutinesuiv; + PFNGLGETUNIFORMSUBROUTINEUIVPROC glGetUniformSubroutineuiv; + PFNGLGETPROGRAMSTAGEIVPROC glGetProgramStageiv; + PFNGLPATCHPARAMETERIPROC glPatchParameteri; + PFNGLPATCHPARAMETERFVPROC glPatchParameterfv; + PFNGLBINDTRANSFORMFEEDBACKPROC glBindTransformFeedback; + PFNGLDELETETRANSFORMFEEDBACKSPROC glDeleteTransformFeedbacks; + PFNGLGENTRANSFORMFEEDBACKSPROC glGenTransformFeedbacks; + PFNGLISTRANSFORMFEEDBACKPROC glIsTransformFeedback; + PFNGLPAUSETRANSFORMFEEDBACKPROC glPauseTransformFeedback; + PFNGLRESUMETRANSFORMFEEDBACKPROC glResumeTransformFeedback; + PFNGLDRAWTRANSFORMFEEDBACKPROC glDrawTransformFeedback; + PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC glDrawTransformFeedbackStream; + PFNGLBEGINQUERYINDEXEDPROC glBeginQueryIndexed; + PFNGLENDQUERYINDEXEDPROC glEndQueryIndexed; + PFNGLGETQUERYINDEXEDIVPROC glGetQueryIndexediv; + #endif + + // Group GL_VERSION_4_1 + #if GL_VERSION_4_1 == 1 + PFNGLRELEASESHADERCOMPILERPROC glReleaseShaderCompiler; + PFNGLSHADERBINARYPROC glShaderBinary; + PFNGLGETSHADERPRECISIONFORMATPROC glGetShaderPrecisionFormat; + PFNGLDEPTHRANGEFPROC glDepthRangef; + PFNGLCLEARDEPTHFPROC glClearDepthf; + PFNGLGETPROGRAMBINARYPROC glGetProgramBinary; + PFNGLPROGRAMBINARYPROC glProgramBinary; + PFNGLPROGRAMPARAMETERIPROC glProgramParameteri; + PFNGLUSEPROGRAMSTAGESPROC glUseProgramStages; + PFNGLACTIVESHADERPROGRAMPROC glActiveShaderProgram; + PFNGLCREATESHADERPROGRAMVPROC glCreateShaderProgramv; + PFNGLBINDPROGRAMPIPELINEPROC glBindProgramPipeline; + PFNGLDELETEPROGRAMPIPELINESPROC glDeleteProgramPipelines; + PFNGLGENPROGRAMPIPELINESPROC glGenProgramPipelines; + PFNGLISPROGRAMPIPELINEPROC glIsProgramPipeline; + PFNGLGETPROGRAMPIPELINEIVPROC glGetProgramPipelineiv; + PFNGLPROGRAMUNIFORM1IPROC glProgramUniform1i; + PFNGLPROGRAMUNIFORM1IVPROC glProgramUniform1iv; + PFNGLPROGRAMUNIFORM1FPROC glProgramUniform1f; + PFNGLPROGRAMUNIFORM1FVPROC glProgramUniform1fv; + PFNGLPROGRAMUNIFORM1DPROC glProgramUniform1d; + PFNGLPROGRAMUNIFORM1DVPROC glProgramUniform1dv; + PFNGLPROGRAMUNIFORM1UIPROC glProgramUniform1ui; + PFNGLPROGRAMUNIFORM1UIVPROC glProgramUniform1uiv; + PFNGLPROGRAMUNIFORM2IPROC glProgramUniform2i; + PFNGLPROGRAMUNIFORM2IVPROC glProgramUniform2iv; + PFNGLPROGRAMUNIFORM2FPROC glProgramUniform2f; + PFNGLPROGRAMUNIFORM2FVPROC glProgramUniform2fv; + PFNGLPROGRAMUNIFORM2DPROC glProgramUniform2d; + PFNGLPROGRAMUNIFORM2DVPROC glProgramUniform2dv; + PFNGLPROGRAMUNIFORM2UIPROC glProgramUniform2ui; + PFNGLPROGRAMUNIFORM2UIVPROC glProgramUniform2uiv; + PFNGLPROGRAMUNIFORM3IPROC glProgramUniform3i; + PFNGLPROGRAMUNIFORM3IVPROC glProgramUniform3iv; + PFNGLPROGRAMUNIFORM3FPROC glProgramUniform3f; + PFNGLPROGRAMUNIFORM3FVPROC glProgramUniform3fv; + PFNGLPROGRAMUNIFORM3DPROC glProgramUniform3d; + PFNGLPROGRAMUNIFORM3DVPROC glProgramUniform3dv; + PFNGLPROGRAMUNIFORM3UIPROC glProgramUniform3ui; + PFNGLPROGRAMUNIFORM3UIVPROC glProgramUniform3uiv; + PFNGLPROGRAMUNIFORM4IPROC glProgramUniform4i; + PFNGLPROGRAMUNIFORM4IVPROC glProgramUniform4iv; + PFNGLPROGRAMUNIFORM4FPROC glProgramUniform4f; + PFNGLPROGRAMUNIFORM4FVPROC glProgramUniform4fv; + PFNGLPROGRAMUNIFORM4DPROC glProgramUniform4d; + PFNGLPROGRAMUNIFORM4DVPROC glProgramUniform4dv; + PFNGLPROGRAMUNIFORM4UIPROC glProgramUniform4ui; + PFNGLPROGRAMUNIFORM4UIVPROC glProgramUniform4uiv; + PFNGLPROGRAMUNIFORMMATRIX2FVPROC glProgramUniformMatrix2fv; + PFNGLPROGRAMUNIFORMMATRIX3FVPROC glProgramUniformMatrix3fv; + PFNGLPROGRAMUNIFORMMATRIX4FVPROC glProgramUniformMatrix4fv; + PFNGLPROGRAMUNIFORMMATRIX2DVPROC glProgramUniformMatrix2dv; + PFNGLPROGRAMUNIFORMMATRIX3DVPROC glProgramUniformMatrix3dv; + PFNGLPROGRAMUNIFORMMATRIX4DVPROC glProgramUniformMatrix4dv; + PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC glProgramUniformMatrix2x3fv; + PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC glProgramUniformMatrix3x2fv; + PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC glProgramUniformMatrix2x4fv; + PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC glProgramUniformMatrix4x2fv; + PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC glProgramUniformMatrix3x4fv; + PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC glProgramUniformMatrix4x3fv; + PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC glProgramUniformMatrix2x3dv; + PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC glProgramUniformMatrix3x2dv; + PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC glProgramUniformMatrix2x4dv; + PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC glProgramUniformMatrix4x2dv; + PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC glProgramUniformMatrix3x4dv; + PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC glProgramUniformMatrix4x3dv; + PFNGLVALIDATEPROGRAMPIPELINEPROC glValidateProgramPipeline; + PFNGLGETPROGRAMPIPELINEINFOLOGPROC glGetProgramPipelineInfoLog; + PFNGLVERTEXATTRIBL1DPROC glVertexAttribL1d; + PFNGLVERTEXATTRIBL2DPROC glVertexAttribL2d; + PFNGLVERTEXATTRIBL3DPROC glVertexAttribL3d; + PFNGLVERTEXATTRIBL4DPROC glVertexAttribL4d; + PFNGLVERTEXATTRIBL1DVPROC glVertexAttribL1dv; + PFNGLVERTEXATTRIBL2DVPROC glVertexAttribL2dv; + PFNGLVERTEXATTRIBL3DVPROC glVertexAttribL3dv; + PFNGLVERTEXATTRIBL4DVPROC glVertexAttribL4dv; + PFNGLVERTEXATTRIBLPOINTERPROC glVertexAttribLPointer; + PFNGLGETVERTEXATTRIBLDVPROC glGetVertexAttribLdv; + PFNGLVIEWPORTARRAYVPROC glViewportArrayv; + PFNGLVIEWPORTINDEXEDFPROC glViewportIndexedf; + PFNGLVIEWPORTINDEXEDFVPROC glViewportIndexedfv; + PFNGLSCISSORARRAYVPROC glScissorArrayv; + PFNGLSCISSORINDEXEDPROC glScissorIndexed; + PFNGLSCISSORINDEXEDVPROC glScissorIndexedv; + PFNGLDEPTHRANGEARRAYVPROC glDepthRangeArrayv; + PFNGLDEPTHRANGEINDEXEDPROC glDepthRangeIndexed; + PFNGLGETFLOATI_VPROC glGetFloati_v; + PFNGLGETDOUBLEI_VPROC glGetDoublei_v; + #endif + + // Group GL_VERSION_4_2 + #if GL_VERSION_4_2 == 1 + PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC glDrawArraysInstancedBaseInstance; + PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC glDrawElementsInstancedBaseInstance; + PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC glDrawElementsInstancedBaseVertexBaseInstance; + PFNGLGETINTERNALFORMATIVPROC glGetInternalformativ; + PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC glGetActiveAtomicCounterBufferiv; + PFNGLBINDIMAGETEXTUREPROC glBindImageTexture; + PFNGLMEMORYBARRIERPROC glMemoryBarrier; + PFNGLTEXSTORAGE1DPROC glTexStorage1D; + PFNGLTEXSTORAGE2DPROC glTexStorage2D; + PFNGLTEXSTORAGE3DPROC glTexStorage3D; + PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC glDrawTransformFeedbackInstanced; + PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC glDrawTransformFeedbackStreamInstanced; + #endif + + // Group GL_VERSION_4_3 + #if GL_VERSION_4_3 == 1 + PFNGLCLEARBUFFERDATAPROC glClearBufferData; + PFNGLCLEARBUFFERSUBDATAPROC glClearBufferSubData; + PFNGLDISPATCHCOMPUTEPROC glDispatchCompute; + PFNGLDISPATCHCOMPUTEINDIRECTPROC glDispatchComputeIndirect; + PFNGLCOPYIMAGESUBDATAPROC glCopyImageSubData; + PFNGLFRAMEBUFFERPARAMETERIPROC glFramebufferParameteri; + PFNGLGETFRAMEBUFFERPARAMETERIVPROC glGetFramebufferParameteriv; + PFNGLGETINTERNALFORMATI64VPROC glGetInternalformati64v; + PFNGLINVALIDATETEXSUBIMAGEPROC glInvalidateTexSubImage; + PFNGLINVALIDATETEXIMAGEPROC glInvalidateTexImage; + PFNGLINVALIDATEBUFFERSUBDATAPROC glInvalidateBufferSubData; + PFNGLINVALIDATEBUFFERDATAPROC glInvalidateBufferData; + PFNGLINVALIDATEFRAMEBUFFERPROC glInvalidateFramebuffer; + PFNGLINVALIDATESUBFRAMEBUFFERPROC glInvalidateSubFramebuffer; + PFNGLMULTIDRAWARRAYSINDIRECTPROC glMultiDrawArraysIndirect; + PFNGLMULTIDRAWELEMENTSINDIRECTPROC glMultiDrawElementsIndirect; + PFNGLGETPROGRAMINTERFACEIVPROC glGetProgramInterfaceiv; + PFNGLGETPROGRAMRESOURCEINDEXPROC glGetProgramResourceIndex; + PFNGLGETPROGRAMRESOURCENAMEPROC glGetProgramResourceName; + PFNGLGETPROGRAMRESOURCEIVPROC glGetProgramResourceiv; + PFNGLGETPROGRAMRESOURCELOCATIONPROC glGetProgramResourceLocation; + PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC glGetProgramResourceLocationIndex; + PFNGLSHADERSTORAGEBLOCKBINDINGPROC glShaderStorageBlockBinding; + PFNGLTEXBUFFERRANGEPROC glTexBufferRange; + PFNGLTEXSTORAGE2DMULTISAMPLEPROC glTexStorage2DMultisample; + PFNGLTEXSTORAGE3DMULTISAMPLEPROC glTexStorage3DMultisample; + PFNGLTEXTUREVIEWPROC glTextureView; + PFNGLBINDVERTEXBUFFERPROC glBindVertexBuffer; + PFNGLVERTEXATTRIBFORMATPROC glVertexAttribFormat; + PFNGLVERTEXATTRIBIFORMATPROC glVertexAttribIFormat; + PFNGLVERTEXATTRIBLFORMATPROC glVertexAttribLFormat; + PFNGLVERTEXATTRIBBINDINGPROC glVertexAttribBinding; + PFNGLVERTEXBINDINGDIVISORPROC glVertexBindingDivisor; + PFNGLDEBUGMESSAGECONTROLPROC glDebugMessageControl; + PFNGLDEBUGMESSAGEINSERTPROC glDebugMessageInsert; + PFNGLDEBUGMESSAGECALLBACKPROC glDebugMessageCallback; + PFNGLGETDEBUGMESSAGELOGPROC glGetDebugMessageLog; + PFNGLPUSHDEBUGGROUPPROC glPushDebugGroup; + PFNGLPOPDEBUGGROUPPROC glPopDebugGroup; + PFNGLOBJECTLABELPROC glObjectLabel; + PFNGLGETOBJECTLABELPROC glGetObjectLabel; + PFNGLOBJECTPTRLABELPROC glObjectPtrLabel; + PFNGLGETOBJECTPTRLABELPROC glGetObjectPtrLabel; + #endif + + // Group GL_VERSION_4_4 + #if GL_VERSION_4_4 == 1 + PFNGLBUFFERSTORAGEPROC glBufferStorage; + PFNGLCLEARTEXIMAGEPROC glClearTexImage; + PFNGLCLEARTEXSUBIMAGEPROC glClearTexSubImage; + PFNGLBINDBUFFERSBASEPROC glBindBuffersBase; + PFNGLBINDBUFFERSRANGEPROC glBindBuffersRange; + PFNGLBINDTEXTURESPROC glBindTextures; + PFNGLBINDSAMPLERSPROC glBindSamplers; + PFNGLBINDIMAGETEXTURESPROC glBindImageTextures; + PFNGLBINDVERTEXBUFFERSPROC glBindVertexBuffers; + #endif + + // Group GL_VERSION_4_5 + #if GL_VERSION_4_5 == 1 + PFNGLCLIPCONTROLPROC glClipControl; + PFNGLCREATETRANSFORMFEEDBACKSPROC glCreateTransformFeedbacks; + PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC glTransformFeedbackBufferBase; + PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC glTransformFeedbackBufferRange; + PFNGLGETTRANSFORMFEEDBACKIVPROC glGetTransformFeedbackiv; + PFNGLGETTRANSFORMFEEDBACKI_VPROC glGetTransformFeedbacki_v; + PFNGLGETTRANSFORMFEEDBACKI64_VPROC glGetTransformFeedbacki64_v; + PFNGLCREATEBUFFERSPROC glCreateBuffers; + PFNGLNAMEDBUFFERSTORAGEPROC glNamedBufferStorage; + PFNGLNAMEDBUFFERDATAPROC glNamedBufferData; + PFNGLNAMEDBUFFERSUBDATAPROC glNamedBufferSubData; + PFNGLCOPYNAMEDBUFFERSUBDATAPROC glCopyNamedBufferSubData; + PFNGLCLEARNAMEDBUFFERDATAPROC glClearNamedBufferData; + PFNGLCLEARNAMEDBUFFERSUBDATAPROC glClearNamedBufferSubData; + PFNGLMAPNAMEDBUFFERPROC glMapNamedBuffer; + PFNGLMAPNAMEDBUFFERRANGEPROC glMapNamedBufferRange; + PFNGLUNMAPNAMEDBUFFERPROC glUnmapNamedBuffer; + PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC glFlushMappedNamedBufferRange; + PFNGLGETNAMEDBUFFERPARAMETERIVPROC glGetNamedBufferParameteriv; + PFNGLGETNAMEDBUFFERPARAMETERI64VPROC glGetNamedBufferParameteri64v; + PFNGLGETNAMEDBUFFERPOINTERVPROC glGetNamedBufferPointerv; + PFNGLGETNAMEDBUFFERSUBDATAPROC glGetNamedBufferSubData; + PFNGLCREATEFRAMEBUFFERSPROC glCreateFramebuffers; + PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC glNamedFramebufferRenderbuffer; + PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC glNamedFramebufferParameteri; + PFNGLNAMEDFRAMEBUFFERTEXTUREPROC glNamedFramebufferTexture; + PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC glNamedFramebufferTextureLayer; + PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC glNamedFramebufferDrawBuffer; + PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC glNamedFramebufferDrawBuffers; + PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC glNamedFramebufferReadBuffer; + PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC glInvalidateNamedFramebufferData; + PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC glInvalidateNamedFramebufferSubData; + PFNGLCLEARNAMEDFRAMEBUFFERIVPROC glClearNamedFramebufferiv; + PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC glClearNamedFramebufferuiv; + PFNGLCLEARNAMEDFRAMEBUFFERFVPROC glClearNamedFramebufferfv; + PFNGLCLEARNAMEDFRAMEBUFFERFIPROC glClearNamedFramebufferfi; + PFNGLBLITNAMEDFRAMEBUFFERPROC glBlitNamedFramebuffer; + PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC glCheckNamedFramebufferStatus; + PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC glGetNamedFramebufferParameteriv; + PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC glGetNamedFramebufferAttachmentParameteriv; + PFNGLCREATERENDERBUFFERSPROC glCreateRenderbuffers; + PFNGLNAMEDRENDERBUFFERSTORAGEPROC glNamedRenderbufferStorage; + PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC glNamedRenderbufferStorageMultisample; + PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC glGetNamedRenderbufferParameteriv; + PFNGLCREATETEXTURESPROC glCreateTextures; + PFNGLTEXTUREBUFFERPROC glTextureBuffer; + PFNGLTEXTUREBUFFERRANGEPROC glTextureBufferRange; + PFNGLTEXTURESTORAGE1DPROC glTextureStorage1D; + PFNGLTEXTURESTORAGE2DPROC glTextureStorage2D; + PFNGLTEXTURESTORAGE3DPROC glTextureStorage3D; + PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC glTextureStorage2DMultisample; + PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC glTextureStorage3DMultisample; + PFNGLTEXTURESUBIMAGE1DPROC glTextureSubImage1D; + PFNGLTEXTURESUBIMAGE2DPROC glTextureSubImage2D; + PFNGLTEXTURESUBIMAGE3DPROC glTextureSubImage3D; + PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC glCompressedTextureSubImage1D; + PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC glCompressedTextureSubImage2D; + PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC glCompressedTextureSubImage3D; + PFNGLCOPYTEXTURESUBIMAGE1DPROC glCopyTextureSubImage1D; + PFNGLCOPYTEXTURESUBIMAGE2DPROC glCopyTextureSubImage2D; + PFNGLCOPYTEXTURESUBIMAGE3DPROC glCopyTextureSubImage3D; + PFNGLTEXTUREPARAMETERFPROC glTextureParameterf; + PFNGLTEXTUREPARAMETERFVPROC glTextureParameterfv; + PFNGLTEXTUREPARAMETERIPROC glTextureParameteri; + PFNGLTEXTUREPARAMETERIIVPROC glTextureParameterIiv; + PFNGLTEXTUREPARAMETERIUIVPROC glTextureParameterIuiv; + PFNGLTEXTUREPARAMETERIVPROC glTextureParameteriv; + PFNGLGENERATETEXTUREMIPMAPPROC glGenerateTextureMipmap; + PFNGLBINDTEXTUREUNITPROC glBindTextureUnit; + PFNGLGETTEXTUREIMAGEPROC glGetTextureImage; + PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC glGetCompressedTextureImage; + PFNGLGETTEXTURELEVELPARAMETERFVPROC glGetTextureLevelParameterfv; + PFNGLGETTEXTURELEVELPARAMETERIVPROC glGetTextureLevelParameteriv; + PFNGLGETTEXTUREPARAMETERFVPROC glGetTextureParameterfv; + PFNGLGETTEXTUREPARAMETERIIVPROC glGetTextureParameterIiv; + PFNGLGETTEXTUREPARAMETERIUIVPROC glGetTextureParameterIuiv; + PFNGLGETTEXTUREPARAMETERIVPROC glGetTextureParameteriv; + PFNGLCREATEVERTEXARRAYSPROC glCreateVertexArrays; + PFNGLDISABLEVERTEXARRAYATTRIBPROC glDisableVertexArrayAttrib; + PFNGLENABLEVERTEXARRAYATTRIBPROC glEnableVertexArrayAttrib; + PFNGLVERTEXARRAYELEMENTBUFFERPROC glVertexArrayElementBuffer; + PFNGLVERTEXARRAYVERTEXBUFFERPROC glVertexArrayVertexBuffer; + PFNGLVERTEXARRAYVERTEXBUFFERSPROC glVertexArrayVertexBuffers; + PFNGLVERTEXARRAYATTRIBBINDINGPROC glVertexArrayAttribBinding; + PFNGLVERTEXARRAYATTRIBFORMATPROC glVertexArrayAttribFormat; + PFNGLVERTEXARRAYATTRIBIFORMATPROC glVertexArrayAttribIFormat; + PFNGLVERTEXARRAYATTRIBLFORMATPROC glVertexArrayAttribLFormat; + PFNGLVERTEXARRAYBINDINGDIVISORPROC glVertexArrayBindingDivisor; + PFNGLGETVERTEXARRAYIVPROC glGetVertexArrayiv; + PFNGLGETVERTEXARRAYINDEXEDIVPROC glGetVertexArrayIndexediv; + PFNGLGETVERTEXARRAYINDEXED64IVPROC glGetVertexArrayIndexed64iv; + PFNGLCREATESAMPLERSPROC glCreateSamplers; + PFNGLCREATEPROGRAMPIPELINESPROC glCreateProgramPipelines; + PFNGLCREATEQUERIESPROC glCreateQueries; + PFNGLGETQUERYBUFFEROBJECTI64VPROC glGetQueryBufferObjecti64v; + PFNGLGETQUERYBUFFEROBJECTIVPROC glGetQueryBufferObjectiv; + PFNGLGETQUERYBUFFEROBJECTUI64VPROC glGetQueryBufferObjectui64v; + PFNGLGETQUERYBUFFEROBJECTUIVPROC glGetQueryBufferObjectuiv; + PFNGLMEMORYBARRIERBYREGIONPROC glMemoryBarrierByRegion; + PFNGLGETTEXTURESUBIMAGEPROC glGetTextureSubImage; + PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC glGetCompressedTextureSubImage; + PFNGLGETGRAPHICSRESETSTATUSPROC glGetGraphicsResetStatus; + PFNGLGETNCOMPRESSEDTEXIMAGEPROC glGetnCompressedTexImage; + PFNGLGETNTEXIMAGEPROC glGetnTexImage; + PFNGLGETNUNIFORMDVPROC glGetnUniformdv; + PFNGLGETNUNIFORMFVPROC glGetnUniformfv; + PFNGLGETNUNIFORMIVPROC glGetnUniformiv; + PFNGLGETNUNIFORMUIVPROC glGetnUniformuiv; + PFNGLREADNPIXELSPROC glReadnPixels; + PFNGLGETNMAPDVPROC glGetnMapdv; + PFNGLGETNMAPFVPROC glGetnMapfv; + PFNGLGETNMAPIVPROC glGetnMapiv; + PFNGLGETNPIXELMAPFVPROC glGetnPixelMapfv; + PFNGLGETNPIXELMAPUIVPROC glGetnPixelMapuiv; + PFNGLGETNPIXELMAPUSVPROC glGetnPixelMapusv; + PFNGLGETNPOLYGONSTIPPLEPROC glGetnPolygonStipple; + PFNGLGETNCOLORTABLEPROC glGetnColorTable; + PFNGLGETNCONVOLUTIONFILTERPROC glGetnConvolutionFilter; + PFNGLGETNSEPARABLEFILTERPROC glGetnSeparableFilter; + PFNGLGETNHISTOGRAMPROC glGetnHistogram; + PFNGLGETNMINMAXPROC glGetnMinmax; + PFNGLTEXTUREBARRIERPROC glTextureBarrier; + #endif + + // Group GL_ARB_bindless_texture + #if GL_ARB_bindless_texture == 1 + PFNGLGETTEXTUREHANDLEARBPROC glGetTextureHandleARB; + PFNGLGETTEXTURESAMPLERHANDLEARBPROC glGetTextureSamplerHandleARB; + PFNGLMAKETEXTUREHANDLERESIDENTARBPROC glMakeTextureHandleResidentARB; + PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC glMakeTextureHandleNonResidentARB; + PFNGLGETIMAGEHANDLEARBPROC glGetImageHandleARB; + PFNGLMAKEIMAGEHANDLERESIDENTARBPROC glMakeImageHandleResidentARB; + PFNGLMAKEIMAGEHANDLENONRESIDENTARBPROC glMakeImageHandleNonResidentARB; + PFNGLUNIFORMHANDLEUI64ARBPROC glUniformHandleui64ARB; + PFNGLUNIFORMHANDLEUI64VARBPROC glUniformHandleui64vARB; + PFNGLPROGRAMUNIFORMHANDLEUI64ARBPROC glProgramUniformHandleui64ARB; + PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC glProgramUniformHandleui64vARB; + PFNGLISTEXTUREHANDLERESIDENTARBPROC glIsTextureHandleResidentARB; + PFNGLISIMAGEHANDLERESIDENTARBPROC glIsImageHandleResidentARB; + PFNGLVERTEXATTRIBL1UI64ARBPROC glVertexAttribL1ui64ARB; + PFNGLVERTEXATTRIBL1UI64VARBPROC glVertexAttribL1ui64vARB; + PFNGLGETVERTEXATTRIBLUI64VARBPROC glGetVertexAttribLui64vARB; + #endif + + // Group GL_ARB_cl_event + #if GL_ARB_cl_event == 1 + PFNGLCREATESYNCFROMCLEVENTARBPROC glCreateSyncFromCLeventARB; + #endif + + // Group GL_ARB_color_buffer_float + #if GL_ARB_color_buffer_float == 1 + PFNGLCLAMPCOLORARBPROC glClampColorARB; + #endif + + // Group GL_ARB_compute_variable_group_size + #if GL_ARB_compute_variable_group_size == 1 + PFNGLDISPATCHCOMPUTEGROUPSIZEARBPROC glDispatchComputeGroupSizeARB; + #endif + + // Group GL_ARB_debug_output + #if GL_ARB_debug_output == 1 + PFNGLDEBUGMESSAGECONTROLARBPROC glDebugMessageControlARB; + PFNGLDEBUGMESSAGEINSERTARBPROC glDebugMessageInsertARB; + PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARB; + PFNGLGETDEBUGMESSAGELOGARBPROC glGetDebugMessageLogARB; + #endif + + // Group GL_ARB_draw_buffers + #if GL_ARB_draw_buffers == 1 + PFNGLDRAWBUFFERSARBPROC glDrawBuffersARB; + #endif + + // Group GL_ARB_draw_buffers_blend + #if GL_ARB_draw_buffers_blend == 1 + PFNGLBLENDEQUATIONIARBPROC glBlendEquationiARB; + PFNGLBLENDEQUATIONSEPARATEIARBPROC glBlendEquationSeparateiARB; + PFNGLBLENDFUNCIARBPROC glBlendFunciARB; + PFNGLBLENDFUNCSEPARATEIARBPROC glBlendFuncSeparateiARB; + #endif + + // Group GL_ARB_draw_instanced + #if GL_ARB_draw_instanced == 1 + PFNGLDRAWARRAYSINSTANCEDARBPROC glDrawArraysInstancedARB; + PFNGLDRAWELEMENTSINSTANCEDARBPROC glDrawElementsInstancedARB; + #endif + + // Group GL_ARB_fragment_program + #if GL_ARB_fragment_program == 1 + PFNGLPROGRAMSTRINGARBPROC glProgramStringARB; + PFNGLBINDPROGRAMARBPROC glBindProgramARB; + PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB; + PFNGLGENPROGRAMSARBPROC glGenProgramsARB; + PFNGLPROGRAMENVPARAMETER4DARBPROC glProgramEnvParameter4dARB; + PFNGLPROGRAMENVPARAMETER4DVARBPROC glProgramEnvParameter4dvARB; + PFNGLPROGRAMENVPARAMETER4FARBPROC glProgramEnvParameter4fARB; + PFNGLPROGRAMENVPARAMETER4FVARBPROC glProgramEnvParameter4fvARB; + PFNGLPROGRAMLOCALPARAMETER4DARBPROC glProgramLocalParameter4dARB; + PFNGLPROGRAMLOCALPARAMETER4DVARBPROC glProgramLocalParameter4dvARB; + PFNGLPROGRAMLOCALPARAMETER4FARBPROC glProgramLocalParameter4fARB; + PFNGLPROGRAMLOCALPARAMETER4FVARBPROC glProgramLocalParameter4fvARB; + PFNGLGETPROGRAMENVPARAMETERDVARBPROC glGetProgramEnvParameterdvARB; + PFNGLGETPROGRAMENVPARAMETERFVARBPROC glGetProgramEnvParameterfvARB; + PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC glGetProgramLocalParameterdvARB; + PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC glGetProgramLocalParameterfvARB; + PFNGLGETPROGRAMIVARBPROC glGetProgramivARB; + PFNGLGETPROGRAMSTRINGARBPROC glGetProgramStringARB; + PFNGLISPROGRAMARBPROC glIsProgramARB; + #endif + + // Group GL_ARB_geometry_shader4 + #if GL_ARB_geometry_shader4 == 1 + PFNGLPROGRAMPARAMETERIARBPROC glProgramParameteriARB; + PFNGLFRAMEBUFFERTEXTUREARBPROC glFramebufferTextureARB; + PFNGLFRAMEBUFFERTEXTURELAYERARBPROC glFramebufferTextureLayerARB; + PFNGLFRAMEBUFFERTEXTUREFACEARBPROC glFramebufferTextureFaceARB; + #endif + + // Group GL_ARB_imaging + #if GL_ARB_imaging == 1 + PFNGLCOLORTABLEPROC glColorTable; + PFNGLCOLORTABLEPARAMETERFVPROC glColorTableParameterfv; + PFNGLCOLORTABLEPARAMETERIVPROC glColorTableParameteriv; + PFNGLCOPYCOLORTABLEPROC glCopyColorTable; + PFNGLGETCOLORTABLEPROC glGetColorTable; + PFNGLGETCOLORTABLEPARAMETERFVPROC glGetColorTableParameterfv; + PFNGLGETCOLORTABLEPARAMETERIVPROC glGetColorTableParameteriv; + PFNGLCOLORSUBTABLEPROC glColorSubTable; + PFNGLCOPYCOLORSUBTABLEPROC glCopyColorSubTable; + PFNGLCONVOLUTIONFILTER1DPROC glConvolutionFilter1D; + PFNGLCONVOLUTIONFILTER2DPROC glConvolutionFilter2D; + PFNGLCONVOLUTIONPARAMETERFPROC glConvolutionParameterf; + PFNGLCONVOLUTIONPARAMETERFVPROC glConvolutionParameterfv; + PFNGLCONVOLUTIONPARAMETERIPROC glConvolutionParameteri; + PFNGLCONVOLUTIONPARAMETERIVPROC glConvolutionParameteriv; + PFNGLCOPYCONVOLUTIONFILTER1DPROC glCopyConvolutionFilter1D; + PFNGLCOPYCONVOLUTIONFILTER2DPROC glCopyConvolutionFilter2D; + PFNGLGETCONVOLUTIONFILTERPROC glGetConvolutionFilter; + PFNGLGETCONVOLUTIONPARAMETERFVPROC glGetConvolutionParameterfv; + PFNGLGETCONVOLUTIONPARAMETERIVPROC glGetConvolutionParameteriv; + PFNGLGETSEPARABLEFILTERPROC glGetSeparableFilter; + PFNGLSEPARABLEFILTER2DPROC glSeparableFilter2D; + PFNGLGETHISTOGRAMPROC glGetHistogram; + PFNGLGETHISTOGRAMPARAMETERFVPROC glGetHistogramParameterfv; + PFNGLGETHISTOGRAMPARAMETERIVPROC glGetHistogramParameteriv; + PFNGLGETMINMAXPROC glGetMinmax; + PFNGLGETMINMAXPARAMETERFVPROC glGetMinmaxParameterfv; + PFNGLGETMINMAXPARAMETERIVPROC glGetMinmaxParameteriv; + PFNGLHISTOGRAMPROC glHistogram; + PFNGLMINMAXPROC glMinmax; + PFNGLRESETHISTOGRAMPROC glResetHistogram; + PFNGLRESETMINMAXPROC glResetMinmax; + #endif + + // Group GL_ARB_indirect_parameters + #if GL_ARB_indirect_parameters == 1 + PFNGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC glMultiDrawArraysIndirectCountARB; + PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC glMultiDrawElementsIndirectCountARB; + #endif + + // Group GL_ARB_instanced_arrays + #if GL_ARB_instanced_arrays == 1 + PFNGLVERTEXATTRIBDIVISORARBPROC glVertexAttribDivisorARB; + #endif + + // Group GL_ARB_matrix_palette + #if GL_ARB_matrix_palette == 1 + PFNGLCURRENTPALETTEMATRIXARBPROC glCurrentPaletteMatrixARB; + PFNGLMATRIXINDEXUBVARBPROC glMatrixIndexubvARB; + PFNGLMATRIXINDEXUSVARBPROC glMatrixIndexusvARB; + PFNGLMATRIXINDEXUIVARBPROC glMatrixIndexuivARB; + PFNGLMATRIXINDEXPOINTERARBPROC glMatrixIndexPointerARB; + #endif + + // Group GL_ARB_multisample + #if GL_ARB_multisample == 1 + PFNGLSAMPLECOVERAGEARBPROC glSampleCoverageARB; + #endif + + // Group GL_ARB_multitexture + #if GL_ARB_multitexture == 1 + PFNGLACTIVETEXTUREARBPROC glActiveTextureARB; + PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB; + PFNGLMULTITEXCOORD1DARBPROC glMultiTexCoord1dARB; + PFNGLMULTITEXCOORD1DVARBPROC glMultiTexCoord1dvARB; + PFNGLMULTITEXCOORD1FARBPROC glMultiTexCoord1fARB; + PFNGLMULTITEXCOORD1FVARBPROC glMultiTexCoord1fvARB; + PFNGLMULTITEXCOORD1IARBPROC glMultiTexCoord1iARB; + PFNGLMULTITEXCOORD1IVARBPROC glMultiTexCoord1ivARB; + PFNGLMULTITEXCOORD1SARBPROC glMultiTexCoord1sARB; + PFNGLMULTITEXCOORD1SVARBPROC glMultiTexCoord1svARB; + PFNGLMULTITEXCOORD2DARBPROC glMultiTexCoord2dARB; + PFNGLMULTITEXCOORD2DVARBPROC glMultiTexCoord2dvARB; + PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARB; + PFNGLMULTITEXCOORD2FVARBPROC glMultiTexCoord2fvARB; + PFNGLMULTITEXCOORD2IARBPROC glMultiTexCoord2iARB; + PFNGLMULTITEXCOORD2IVARBPROC glMultiTexCoord2ivARB; + PFNGLMULTITEXCOORD2SARBPROC glMultiTexCoord2sARB; + PFNGLMULTITEXCOORD2SVARBPROC glMultiTexCoord2svARB; + PFNGLMULTITEXCOORD3DARBPROC glMultiTexCoord3dARB; + PFNGLMULTITEXCOORD3DVARBPROC glMultiTexCoord3dvARB; + PFNGLMULTITEXCOORD3FARBPROC glMultiTexCoord3fARB; + PFNGLMULTITEXCOORD3FVARBPROC glMultiTexCoord3fvARB; + PFNGLMULTITEXCOORD3IARBPROC glMultiTexCoord3iARB; + PFNGLMULTITEXCOORD3IVARBPROC glMultiTexCoord3ivARB; + PFNGLMULTITEXCOORD3SARBPROC glMultiTexCoord3sARB; + PFNGLMULTITEXCOORD3SVARBPROC glMultiTexCoord3svARB; + PFNGLMULTITEXCOORD4DARBPROC glMultiTexCoord4dARB; + PFNGLMULTITEXCOORD4DVARBPROC glMultiTexCoord4dvARB; + PFNGLMULTITEXCOORD4FARBPROC glMultiTexCoord4fARB; + PFNGLMULTITEXCOORD4FVARBPROC glMultiTexCoord4fvARB; + PFNGLMULTITEXCOORD4IARBPROC glMultiTexCoord4iARB; + PFNGLMULTITEXCOORD4IVARBPROC glMultiTexCoord4ivARB; + PFNGLMULTITEXCOORD4SARBPROC glMultiTexCoord4sARB; + PFNGLMULTITEXCOORD4SVARBPROC glMultiTexCoord4svARB; + #endif + + // Group GL_ARB_occlusion_query + #if GL_ARB_occlusion_query == 1 + PFNGLGENQUERIESARBPROC glGenQueriesARB; + PFNGLDELETEQUERIESARBPROC glDeleteQueriesARB; + PFNGLISQUERYARBPROC glIsQueryARB; + PFNGLBEGINQUERYARBPROC glBeginQueryARB; + PFNGLENDQUERYARBPROC glEndQueryARB; + PFNGLGETQUERYIVARBPROC glGetQueryivARB; + PFNGLGETQUERYOBJECTIVARBPROC glGetQueryObjectivARB; + PFNGLGETQUERYOBJECTUIVARBPROC glGetQueryObjectuivARB; + #endif + + // Group GL_ARB_point_parameters + #if GL_ARB_point_parameters == 1 + PFNGLPOINTPARAMETERFARBPROC glPointParameterfARB; + PFNGLPOINTPARAMETERFVARBPROC glPointParameterfvARB; + #endif + + // Group GL_ARB_robustness + #if GL_ARB_robustness == 1 + PFNGLGETGRAPHICSRESETSTATUSARBPROC glGetGraphicsResetStatusARB; + PFNGLGETNTEXIMAGEARBPROC glGetnTexImageARB; + PFNGLREADNPIXELSARBPROC glReadnPixelsARB; + PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC glGetnCompressedTexImageARB; + PFNGLGETNUNIFORMFVARBPROC glGetnUniformfvARB; + PFNGLGETNUNIFORMIVARBPROC glGetnUniformivARB; + PFNGLGETNUNIFORMUIVARBPROC glGetnUniformuivARB; + PFNGLGETNUNIFORMDVARBPROC glGetnUniformdvARB; + PFNGLGETNMAPDVARBPROC glGetnMapdvARB; + PFNGLGETNMAPFVARBPROC glGetnMapfvARB; + PFNGLGETNMAPIVARBPROC glGetnMapivARB; + PFNGLGETNPIXELMAPFVARBPROC glGetnPixelMapfvARB; + PFNGLGETNPIXELMAPUIVARBPROC glGetnPixelMapuivARB; + PFNGLGETNPIXELMAPUSVARBPROC glGetnPixelMapusvARB; + PFNGLGETNPOLYGONSTIPPLEARBPROC glGetnPolygonStippleARB; + PFNGLGETNCOLORTABLEARBPROC glGetnColorTableARB; + PFNGLGETNCONVOLUTIONFILTERARBPROC glGetnConvolutionFilterARB; + PFNGLGETNSEPARABLEFILTERARBPROC glGetnSeparableFilterARB; + PFNGLGETNHISTOGRAMARBPROC glGetnHistogramARB; + PFNGLGETNMINMAXARBPROC glGetnMinmaxARB; + #endif + + // Group GL_ARB_sample_shading + #if GL_ARB_sample_shading == 1 + PFNGLMINSAMPLESHADINGARBPROC glMinSampleShadingARB; + #endif + + // Group GL_ARB_shading_language_include + #if GL_ARB_shading_language_include == 1 + PFNGLNAMEDSTRINGARBPROC glNamedStringARB; + PFNGLDELETENAMEDSTRINGARBPROC glDeleteNamedStringARB; + PFNGLCOMPILESHADERINCLUDEARBPROC glCompileShaderIncludeARB; + PFNGLISNAMEDSTRINGARBPROC glIsNamedStringARB; + PFNGLGETNAMEDSTRINGARBPROC glGetNamedStringARB; + PFNGLGETNAMEDSTRINGIVARBPROC glGetNamedStringivARB; + #endif + + // Group GL_ARB_sparse_buffer + #if GL_ARB_sparse_buffer == 1 + PFNGLBUFFERPAGECOMMITMENTARBPROC glBufferPageCommitmentARB; + PFNGLNAMEDBUFFERPAGECOMMITMENTEXTPROC glNamedBufferPageCommitmentEXT; + PFNGLNAMEDBUFFERPAGECOMMITMENTARBPROC glNamedBufferPageCommitmentARB; + #endif + + // Group GL_ARB_sparse_texture + #if GL_ARB_sparse_texture == 1 + PFNGLTEXPAGECOMMITMENTARBPROC glTexPageCommitmentARB; + #endif + + // Group GL_ARB_texture_buffer_object + #if GL_ARB_texture_buffer_object == 1 + PFNGLTEXBUFFERARBPROC glTexBufferARB; + #endif + + // Group GL_ARB_texture_compression + #if GL_ARB_texture_compression == 1 + PFNGLCOMPRESSEDTEXIMAGE3DARBPROC glCompressedTexImage3DARB; + PFNGLCOMPRESSEDTEXIMAGE2DARBPROC glCompressedTexImage2DARB; + PFNGLCOMPRESSEDTEXIMAGE1DARBPROC glCompressedTexImage1DARB; + PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC glCompressedTexSubImage3DARB; + PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC glCompressedTexSubImage2DARB; + PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC glCompressedTexSubImage1DARB; + PFNGLGETCOMPRESSEDTEXIMAGEARBPROC glGetCompressedTexImageARB; + #endif + + // Group GL_ARB_transpose_matrix + #if GL_ARB_transpose_matrix == 1 + PFNGLLOADTRANSPOSEMATRIXFARBPROC glLoadTransposeMatrixfARB; + PFNGLLOADTRANSPOSEMATRIXDARBPROC glLoadTransposeMatrixdARB; + PFNGLMULTTRANSPOSEMATRIXFARBPROC glMultTransposeMatrixfARB; + PFNGLMULTTRANSPOSEMATRIXDARBPROC glMultTransposeMatrixdARB; + #endif + + // Group GL_ARB_vertex_blend + #if GL_ARB_vertex_blend == 1 + PFNGLWEIGHTBVARBPROC glWeightbvARB; + PFNGLWEIGHTSVARBPROC glWeightsvARB; + PFNGLWEIGHTIVARBPROC glWeightivARB; + PFNGLWEIGHTFVARBPROC glWeightfvARB; + PFNGLWEIGHTDVARBPROC glWeightdvARB; + PFNGLWEIGHTUBVARBPROC glWeightubvARB; + PFNGLWEIGHTUSVARBPROC glWeightusvARB; + PFNGLWEIGHTUIVARBPROC glWeightuivARB; + PFNGLWEIGHTPOINTERARBPROC glWeightPointerARB; + PFNGLVERTEXBLENDARBPROC glVertexBlendARB; + #endif + + // Group GL_ARB_vertex_buffer_object + #if GL_ARB_vertex_buffer_object == 1 + PFNGLBINDBUFFERARBPROC glBindBufferARB; + PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB; + PFNGLGENBUFFERSARBPROC glGenBuffersARB; + PFNGLISBUFFERARBPROC glIsBufferARB; + PFNGLBUFFERDATAARBPROC glBufferDataARB; + PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB; + PFNGLGETBUFFERSUBDATAARBPROC glGetBufferSubDataARB; + PFNGLMAPBUFFERARBPROC glMapBufferARB; + PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB; + PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB; + PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB; + #endif + + // Group GL_ARB_vertex_program + #if GL_ARB_vertex_program == 1 + PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB; + PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB; + PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB; + PFNGLVERTEXATTRIB1FVARBPROC glVertexAttrib1fvARB; + PFNGLVERTEXATTRIB1SARBPROC glVertexAttrib1sARB; + PFNGLVERTEXATTRIB1SVARBPROC glVertexAttrib1svARB; + PFNGLVERTEXATTRIB2DARBPROC glVertexAttrib2dARB; + PFNGLVERTEXATTRIB2DVARBPROC glVertexAttrib2dvARB; + PFNGLVERTEXATTRIB2FARBPROC glVertexAttrib2fARB; + PFNGLVERTEXATTRIB2FVARBPROC glVertexAttrib2fvARB; + PFNGLVERTEXATTRIB2SARBPROC glVertexAttrib2sARB; + PFNGLVERTEXATTRIB2SVARBPROC glVertexAttrib2svARB; + PFNGLVERTEXATTRIB3DARBPROC glVertexAttrib3dARB; + PFNGLVERTEXATTRIB3DVARBPROC glVertexAttrib3dvARB; + PFNGLVERTEXATTRIB3FARBPROC glVertexAttrib3fARB; + PFNGLVERTEXATTRIB3FVARBPROC glVertexAttrib3fvARB; + PFNGLVERTEXATTRIB3SARBPROC glVertexAttrib3sARB; + PFNGLVERTEXATTRIB3SVARBPROC glVertexAttrib3svARB; + PFNGLVERTEXATTRIB4NBVARBPROC glVertexAttrib4NbvARB; + PFNGLVERTEXATTRIB4NIVARBPROC glVertexAttrib4NivARB; + PFNGLVERTEXATTRIB4NSVARBPROC glVertexAttrib4NsvARB; + PFNGLVERTEXATTRIB4NUBARBPROC glVertexAttrib4NubARB; + PFNGLVERTEXATTRIB4NUBVARBPROC glVertexAttrib4NubvARB; + PFNGLVERTEXATTRIB4NUIVARBPROC glVertexAttrib4NuivARB; + PFNGLVERTEXATTRIB4NUSVARBPROC glVertexAttrib4NusvARB; + PFNGLVERTEXATTRIB4BVARBPROC glVertexAttrib4bvARB; + PFNGLVERTEXATTRIB4DARBPROC glVertexAttrib4dARB; + PFNGLVERTEXATTRIB4DVARBPROC glVertexAttrib4dvARB; + PFNGLVERTEXATTRIB4FARBPROC glVertexAttrib4fARB; + PFNGLVERTEXATTRIB4FVARBPROC glVertexAttrib4fvARB; + PFNGLVERTEXATTRIB4IVARBPROC glVertexAttrib4ivARB; + PFNGLVERTEXATTRIB4SARBPROC glVertexAttrib4sARB; + PFNGLVERTEXATTRIB4SVARBPROC glVertexAttrib4svARB; + PFNGLVERTEXATTRIB4UBVARBPROC glVertexAttrib4ubvARB; + PFNGLVERTEXATTRIB4UIVARBPROC glVertexAttrib4uivARB; + PFNGLVERTEXATTRIB4USVARBPROC glVertexAttrib4usvARB; + PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB; + PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB; + PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB; + PFNGLGETVERTEXATTRIBDVARBPROC glGetVertexAttribdvARB; + PFNGLGETVERTEXATTRIBFVARBPROC glGetVertexAttribfvARB; + PFNGLGETVERTEXATTRIBIVARBPROC glGetVertexAttribivARB; + PFNGLGETVERTEXATTRIBPOINTERVARBPROC glGetVertexAttribPointervARB; + #endif + + // Group GL_ARB_vertex_shader + #if GL_ARB_vertex_shader == 1 + PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB; + PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB; + PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB; + #endif + + // Group GL_ARB_window_pos + #if GL_ARB_window_pos == 1 + PFNGLWINDOWPOS2DARBPROC glWindowPos2dARB; + PFNGLWINDOWPOS2DVARBPROC glWindowPos2dvARB; + PFNGLWINDOWPOS2FARBPROC glWindowPos2fARB; + PFNGLWINDOWPOS2FVARBPROC glWindowPos2fvARB; + PFNGLWINDOWPOS2IARBPROC glWindowPos2iARB; + PFNGLWINDOWPOS2IVARBPROC glWindowPos2ivARB; + PFNGLWINDOWPOS2SARBPROC glWindowPos2sARB; + PFNGLWINDOWPOS2SVARBPROC glWindowPos2svARB; + PFNGLWINDOWPOS3DARBPROC glWindowPos3dARB; + PFNGLWINDOWPOS3DVARBPROC glWindowPos3dvARB; + PFNGLWINDOWPOS3FARBPROC glWindowPos3fARB; + PFNGLWINDOWPOS3FVARBPROC glWindowPos3fvARB; + PFNGLWINDOWPOS3IARBPROC glWindowPos3iARB; + PFNGLWINDOWPOS3IVARBPROC glWindowPos3ivARB; + PFNGLWINDOWPOS3SARBPROC glWindowPos3sARB; + PFNGLWINDOWPOS3SVARBPROC glWindowPos3svARB; + #endif + + // Group GL_KHR_blend_equation_advanced + #if GL_KHR_blend_equation_advanced == 1 + PFNGLBLENDBARRIERKHRPROC glBlendBarrierKHR; + #endif + + // Group GL_OES_byte_coordinates + #if GL_OES_byte_coordinates == 1 + PFNGLMULTITEXCOORD1BOESPROC glMultiTexCoord1bOES; + PFNGLMULTITEXCOORD1BVOESPROC glMultiTexCoord1bvOES; + PFNGLMULTITEXCOORD2BOESPROC glMultiTexCoord2bOES; + PFNGLMULTITEXCOORD2BVOESPROC glMultiTexCoord2bvOES; + PFNGLMULTITEXCOORD3BOESPROC glMultiTexCoord3bOES; + PFNGLMULTITEXCOORD3BVOESPROC glMultiTexCoord3bvOES; + PFNGLMULTITEXCOORD4BOESPROC glMultiTexCoord4bOES; + PFNGLMULTITEXCOORD4BVOESPROC glMultiTexCoord4bvOES; + PFNGLTEXCOORD1BOESPROC glTexCoord1bOES; + PFNGLTEXCOORD1BVOESPROC glTexCoord1bvOES; + PFNGLTEXCOORD2BOESPROC glTexCoord2bOES; + PFNGLTEXCOORD2BVOESPROC glTexCoord2bvOES; + PFNGLTEXCOORD3BOESPROC glTexCoord3bOES; + PFNGLTEXCOORD3BVOESPROC glTexCoord3bvOES; + PFNGLTEXCOORD4BOESPROC glTexCoord4bOES; + PFNGLTEXCOORD4BVOESPROC glTexCoord4bvOES; + PFNGLVERTEX2BOESPROC glVertex2bOES; + PFNGLVERTEX2BVOESPROC glVertex2bvOES; + PFNGLVERTEX3BOESPROC glVertex3bOES; + PFNGLVERTEX3BVOESPROC glVertex3bvOES; + PFNGLVERTEX4BOESPROC glVertex4bOES; + PFNGLVERTEX4BVOESPROC glVertex4bvOES; + #endif + + // Group GL_OES_fixed_point + #if GL_OES_fixed_point == 1 + PFNGLALPHAFUNCXOESPROC glAlphaFuncxOES; + PFNGLCLEARCOLORXOESPROC glClearColorxOES; + PFNGLCLEARDEPTHXOESPROC glClearDepthxOES; + PFNGLCLIPPLANEXOESPROC glClipPlanexOES; + PFNGLCOLOR4XOESPROC glColor4xOES; + PFNGLDEPTHRANGEXOESPROC glDepthRangexOES; + PFNGLFOGXOESPROC glFogxOES; + PFNGLFOGXVOESPROC glFogxvOES; + PFNGLFRUSTUMXOESPROC glFrustumxOES; + PFNGLGETCLIPPLANEXOESPROC glGetClipPlanexOES; + PFNGLGETFIXEDVOESPROC glGetFixedvOES; + PFNGLGETTEXENVXVOESPROC glGetTexEnvxvOES; + PFNGLGETTEXPARAMETERXVOESPROC glGetTexParameterxvOES; + PFNGLLIGHTMODELXOESPROC glLightModelxOES; + PFNGLLIGHTMODELXVOESPROC glLightModelxvOES; + PFNGLLIGHTXOESPROC glLightxOES; + PFNGLLIGHTXVOESPROC glLightxvOES; + PFNGLLINEWIDTHXOESPROC glLineWidthxOES; + PFNGLLOADMATRIXXOESPROC glLoadMatrixxOES; + PFNGLMATERIALXOESPROC glMaterialxOES; + PFNGLMATERIALXVOESPROC glMaterialxvOES; + PFNGLMULTMATRIXXOESPROC glMultMatrixxOES; + PFNGLMULTITEXCOORD4XOESPROC glMultiTexCoord4xOES; + PFNGLNORMAL3XOESPROC glNormal3xOES; + PFNGLORTHOXOESPROC glOrthoxOES; + PFNGLPOINTPARAMETERXVOESPROC glPointParameterxvOES; + PFNGLPOINTSIZEXOESPROC glPointSizexOES; + PFNGLPOLYGONOFFSETXOESPROC glPolygonOffsetxOES; + PFNGLROTATEXOESPROC glRotatexOES; + PFNGLSCALEXOESPROC glScalexOES; + PFNGLTEXENVXOESPROC glTexEnvxOES; + PFNGLTEXENVXVOESPROC glTexEnvxvOES; + PFNGLTEXPARAMETERXOESPROC glTexParameterxOES; + PFNGLTEXPARAMETERXVOESPROC glTexParameterxvOES; + PFNGLTRANSLATEXOESPROC glTranslatexOES; + PFNGLACCUMXOESPROC glAccumxOES; + PFNGLBITMAPXOESPROC glBitmapxOES; + PFNGLBLENDCOLORXOESPROC glBlendColorxOES; + PFNGLCLEARACCUMXOESPROC glClearAccumxOES; + PFNGLCOLOR3XOESPROC glColor3xOES; + PFNGLCOLOR3XVOESPROC glColor3xvOES; + PFNGLCOLOR4XVOESPROC glColor4xvOES; + PFNGLCONVOLUTIONPARAMETERXOESPROC glConvolutionParameterxOES; + PFNGLCONVOLUTIONPARAMETERXVOESPROC glConvolutionParameterxvOES; + PFNGLEVALCOORD1XOESPROC glEvalCoord1xOES; + PFNGLEVALCOORD1XVOESPROC glEvalCoord1xvOES; + PFNGLEVALCOORD2XOESPROC glEvalCoord2xOES; + PFNGLEVALCOORD2XVOESPROC glEvalCoord2xvOES; + PFNGLFEEDBACKBUFFERXOESPROC glFeedbackBufferxOES; + PFNGLGETCONVOLUTIONPARAMETERXVOESPROC glGetConvolutionParameterxvOES; + PFNGLGETHISTOGRAMPARAMETERXVOESPROC glGetHistogramParameterxvOES; + PFNGLGETLIGHTXOESPROC glGetLightxOES; + PFNGLGETMAPXVOESPROC glGetMapxvOES; + PFNGLGETMATERIALXOESPROC glGetMaterialxOES; + PFNGLGETPIXELMAPXVPROC glGetPixelMapxv; + PFNGLGETTEXGENXVOESPROC glGetTexGenxvOES; + PFNGLGETTEXLEVELPARAMETERXVOESPROC glGetTexLevelParameterxvOES; + PFNGLINDEXXOESPROC glIndexxOES; + PFNGLINDEXXVOESPROC glIndexxvOES; + PFNGLLOADTRANSPOSEMATRIXXOESPROC glLoadTransposeMatrixxOES; + PFNGLMAP1XOESPROC glMap1xOES; + PFNGLMAP2XOESPROC glMap2xOES; + PFNGLMAPGRID1XOESPROC glMapGrid1xOES; + PFNGLMAPGRID2XOESPROC glMapGrid2xOES; + PFNGLMULTTRANSPOSEMATRIXXOESPROC glMultTransposeMatrixxOES; + PFNGLMULTITEXCOORD1XOESPROC glMultiTexCoord1xOES; + PFNGLMULTITEXCOORD1XVOESPROC glMultiTexCoord1xvOES; + PFNGLMULTITEXCOORD2XOESPROC glMultiTexCoord2xOES; + PFNGLMULTITEXCOORD2XVOESPROC glMultiTexCoord2xvOES; + PFNGLMULTITEXCOORD3XOESPROC glMultiTexCoord3xOES; + PFNGLMULTITEXCOORD3XVOESPROC glMultiTexCoord3xvOES; + PFNGLMULTITEXCOORD4XVOESPROC glMultiTexCoord4xvOES; + PFNGLNORMAL3XVOESPROC glNormal3xvOES; + PFNGLPASSTHROUGHXOESPROC glPassThroughxOES; + PFNGLPIXELMAPXPROC glPixelMapx; + PFNGLPIXELSTOREXPROC glPixelStorex; + PFNGLPIXELTRANSFERXOESPROC glPixelTransferxOES; + PFNGLPIXELZOOMXOESPROC glPixelZoomxOES; + PFNGLPRIORITIZETEXTURESXOESPROC glPrioritizeTexturesxOES; + PFNGLRASTERPOS2XOESPROC glRasterPos2xOES; + PFNGLRASTERPOS2XVOESPROC glRasterPos2xvOES; + PFNGLRASTERPOS3XOESPROC glRasterPos3xOES; + PFNGLRASTERPOS3XVOESPROC glRasterPos3xvOES; + PFNGLRASTERPOS4XOESPROC glRasterPos4xOES; + PFNGLRASTERPOS4XVOESPROC glRasterPos4xvOES; + PFNGLRECTXOESPROC glRectxOES; + PFNGLRECTXVOESPROC glRectxvOES; + PFNGLTEXCOORD1XOESPROC glTexCoord1xOES; + PFNGLTEXCOORD1XVOESPROC glTexCoord1xvOES; + PFNGLTEXCOORD2XOESPROC glTexCoord2xOES; + PFNGLTEXCOORD2XVOESPROC glTexCoord2xvOES; + PFNGLTEXCOORD3XOESPROC glTexCoord3xOES; + PFNGLTEXCOORD3XVOESPROC glTexCoord3xvOES; + PFNGLTEXCOORD4XOESPROC glTexCoord4xOES; + PFNGLTEXCOORD4XVOESPROC glTexCoord4xvOES; + PFNGLTEXGENXOESPROC glTexGenxOES; + PFNGLTEXGENXVOESPROC glTexGenxvOES; + PFNGLVERTEX2XOESPROC glVertex2xOES; + PFNGLVERTEX2XVOESPROC glVertex2xvOES; + PFNGLVERTEX3XOESPROC glVertex3xOES; + PFNGLVERTEX3XVOESPROC glVertex3xvOES; + PFNGLVERTEX4XOESPROC glVertex4xOES; + PFNGLVERTEX4XVOESPROC glVertex4xvOES; + #endif + + // Group GL_OES_query_matrix + #if GL_OES_query_matrix == 1 + PFNGLQUERYMATRIXXOESPROC glQueryMatrixxOES; + #endif + + // Group GL_OES_single_precision + #if GL_OES_single_precision == 1 + PFNGLCLEARDEPTHFOESPROC glClearDepthfOES; + PFNGLCLIPPLANEFOESPROC glClipPlanefOES; + PFNGLDEPTHRANGEFOESPROC glDepthRangefOES; + PFNGLFRUSTUMFOESPROC glFrustumfOES; + PFNGLGETCLIPPLANEFOESPROC glGetClipPlanefOES; + PFNGLORTHOFOESPROC glOrthofOES; + #endif + + // Group GL_3DFX_tbuffer + #if GL_3DFX_tbuffer == 1 + PFNGLTBUFFERMASK3DFXPROC glTbufferMask3DFX; + #endif + + // Group GL_AMD_debug_output + #if GL_AMD_debug_output == 1 + PFNGLDEBUGMESSAGEENABLEAMDPROC glDebugMessageEnableAMD; + PFNGLDEBUGMESSAGEINSERTAMDPROC glDebugMessageInsertAMD; + PFNGLDEBUGMESSAGECALLBACKAMDPROC glDebugMessageCallbackAMD; + PFNGLGETDEBUGMESSAGELOGAMDPROC glGetDebugMessageLogAMD; + #endif + + // Group GL_AMD_draw_buffers_blend + #if GL_AMD_draw_buffers_blend == 1 + PFNGLBLENDFUNCINDEXEDAMDPROC glBlendFuncIndexedAMD; + PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC glBlendFuncSeparateIndexedAMD; + PFNGLBLENDEQUATIONINDEXEDAMDPROC glBlendEquationIndexedAMD; + PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC glBlendEquationSeparateIndexedAMD; + #endif + + // Group GL_AMD_gpu_shader_int64 + #if GL_AMD_gpu_shader_int64 == 1 + PFNGLUNIFORM1I64NVPROC glUniform1i64NV; + PFNGLUNIFORM2I64NVPROC glUniform2i64NV; + PFNGLUNIFORM3I64NVPROC glUniform3i64NV; + PFNGLUNIFORM4I64NVPROC glUniform4i64NV; + PFNGLUNIFORM1I64VNVPROC glUniform1i64vNV; + PFNGLUNIFORM2I64VNVPROC glUniform2i64vNV; + PFNGLUNIFORM3I64VNVPROC glUniform3i64vNV; + PFNGLUNIFORM4I64VNVPROC glUniform4i64vNV; + PFNGLUNIFORM1UI64NVPROC glUniform1ui64NV; + PFNGLUNIFORM2UI64NVPROC glUniform2ui64NV; + PFNGLUNIFORM3UI64NVPROC glUniform3ui64NV; + PFNGLUNIFORM4UI64NVPROC glUniform4ui64NV; + PFNGLUNIFORM1UI64VNVPROC glUniform1ui64vNV; + PFNGLUNIFORM2UI64VNVPROC glUniform2ui64vNV; + PFNGLUNIFORM3UI64VNVPROC glUniform3ui64vNV; + PFNGLUNIFORM4UI64VNVPROC glUniform4ui64vNV; + PFNGLGETUNIFORMI64VNVPROC glGetUniformi64vNV; + PFNGLGETUNIFORMUI64VNVPROC glGetUniformui64vNV; + PFNGLPROGRAMUNIFORM1I64NVPROC glProgramUniform1i64NV; + PFNGLPROGRAMUNIFORM2I64NVPROC glProgramUniform2i64NV; + PFNGLPROGRAMUNIFORM3I64NVPROC glProgramUniform3i64NV; + PFNGLPROGRAMUNIFORM4I64NVPROC glProgramUniform4i64NV; + PFNGLPROGRAMUNIFORM1I64VNVPROC glProgramUniform1i64vNV; + PFNGLPROGRAMUNIFORM2I64VNVPROC glProgramUniform2i64vNV; + PFNGLPROGRAMUNIFORM3I64VNVPROC glProgramUniform3i64vNV; + PFNGLPROGRAMUNIFORM4I64VNVPROC glProgramUniform4i64vNV; + PFNGLPROGRAMUNIFORM1UI64NVPROC glProgramUniform1ui64NV; + PFNGLPROGRAMUNIFORM2UI64NVPROC glProgramUniform2ui64NV; + PFNGLPROGRAMUNIFORM3UI64NVPROC glProgramUniform3ui64NV; + PFNGLPROGRAMUNIFORM4UI64NVPROC glProgramUniform4ui64NV; + PFNGLPROGRAMUNIFORM1UI64VNVPROC glProgramUniform1ui64vNV; + PFNGLPROGRAMUNIFORM2UI64VNVPROC glProgramUniform2ui64vNV; + PFNGLPROGRAMUNIFORM3UI64VNVPROC glProgramUniform3ui64vNV; + PFNGLPROGRAMUNIFORM4UI64VNVPROC glProgramUniform4ui64vNV; + #endif + + // Group GL_AMD_interleaved_elements + #if GL_AMD_interleaved_elements == 1 + PFNGLVERTEXATTRIBPARAMETERIAMDPROC glVertexAttribParameteriAMD; + #endif + + // Group GL_AMD_multi_draw_indirect + #if GL_AMD_multi_draw_indirect == 1 + PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC glMultiDrawArraysIndirectAMD; + PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC glMultiDrawElementsIndirectAMD; + #endif + + // Group GL_AMD_name_gen_delete + #if GL_AMD_name_gen_delete == 1 + PFNGLGENNAMESAMDPROC glGenNamesAMD; + PFNGLDELETENAMESAMDPROC glDeleteNamesAMD; + PFNGLISNAMEAMDPROC glIsNameAMD; + #endif + + // Group GL_AMD_occlusion_query_event + #if GL_AMD_occlusion_query_event == 1 + PFNGLQUERYOBJECTPARAMETERUIAMDPROC glQueryObjectParameteruiAMD; + #endif + + // Group GL_AMD_performance_monitor + #if GL_AMD_performance_monitor == 1 + PFNGLGETPERFMONITORGROUPSAMDPROC glGetPerfMonitorGroupsAMD; + PFNGLGETPERFMONITORCOUNTERSAMDPROC glGetPerfMonitorCountersAMD; + PFNGLGETPERFMONITORGROUPSTRINGAMDPROC glGetPerfMonitorGroupStringAMD; + PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC glGetPerfMonitorCounterStringAMD; + PFNGLGETPERFMONITORCOUNTERINFOAMDPROC glGetPerfMonitorCounterInfoAMD; + PFNGLGENPERFMONITORSAMDPROC glGenPerfMonitorsAMD; + PFNGLDELETEPERFMONITORSAMDPROC glDeletePerfMonitorsAMD; + PFNGLSELECTPERFMONITORCOUNTERSAMDPROC glSelectPerfMonitorCountersAMD; + PFNGLBEGINPERFMONITORAMDPROC glBeginPerfMonitorAMD; + PFNGLENDPERFMONITORAMDPROC glEndPerfMonitorAMD; + PFNGLGETPERFMONITORCOUNTERDATAAMDPROC glGetPerfMonitorCounterDataAMD; + #endif + + // Group GL_AMD_sample_positions + #if GL_AMD_sample_positions == 1 + PFNGLSETMULTISAMPLEFVAMDPROC glSetMultisamplefvAMD; + #endif + + // Group GL_AMD_sparse_texture + #if GL_AMD_sparse_texture == 1 + PFNGLTEXSTORAGESPARSEAMDPROC glTexStorageSparseAMD; + PFNGLTEXTURESTORAGESPARSEAMDPROC glTextureStorageSparseAMD; + #endif + + // Group GL_AMD_stencil_operation_extended + #if GL_AMD_stencil_operation_extended == 1 + PFNGLSTENCILOPVALUEAMDPROC glStencilOpValueAMD; + #endif + + // Group GL_AMD_vertex_shader_tessellator + #if GL_AMD_vertex_shader_tessellator == 1 + PFNGLTESSELLATIONFACTORAMDPROC glTessellationFactorAMD; + PFNGLTESSELLATIONMODEAMDPROC glTessellationModeAMD; + #endif + + // Group GL_APPLE_element_array + #if GL_APPLE_element_array == 1 + PFNGLELEMENTPOINTERAPPLEPROC glElementPointerAPPLE; + PFNGLDRAWELEMENTARRAYAPPLEPROC glDrawElementArrayAPPLE; + PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC glDrawRangeElementArrayAPPLE; + PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC glMultiDrawElementArrayAPPLE; + PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC glMultiDrawRangeElementArrayAPPLE; + #endif + + // Group GL_APPLE_fence + #if GL_APPLE_fence == 1 + PFNGLGENFENCESAPPLEPROC glGenFencesAPPLE; + PFNGLDELETEFENCESAPPLEPROC glDeleteFencesAPPLE; + PFNGLSETFENCEAPPLEPROC glSetFenceAPPLE; + PFNGLISFENCEAPPLEPROC glIsFenceAPPLE; + PFNGLTESTFENCEAPPLEPROC glTestFenceAPPLE; + PFNGLFINISHFENCEAPPLEPROC glFinishFenceAPPLE; + PFNGLTESTOBJECTAPPLEPROC glTestObjectAPPLE; + PFNGLFINISHOBJECTAPPLEPROC glFinishObjectAPPLE; + #endif + + // Group GL_APPLE_flush_buffer_range + #if GL_APPLE_flush_buffer_range == 1 + PFNGLBUFFERPARAMETERIAPPLEPROC glBufferParameteriAPPLE; + PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC glFlushMappedBufferRangeAPPLE; + #endif + + // Group GL_APPLE_object_purgeable + #if GL_APPLE_object_purgeable == 1 + PFNGLOBJECTPURGEABLEAPPLEPROC glObjectPurgeableAPPLE; + PFNGLOBJECTUNPURGEABLEAPPLEPROC glObjectUnpurgeableAPPLE; + PFNGLGETOBJECTPARAMETERIVAPPLEPROC glGetObjectParameterivAPPLE; + #endif + + // Group GL_APPLE_texture_range + #if GL_APPLE_texture_range == 1 + PFNGLTEXTURERANGEAPPLEPROC glTextureRangeAPPLE; + PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC glGetTexParameterPointervAPPLE; + #endif + + // Group GL_APPLE_vertex_array_object + #if GL_APPLE_vertex_array_object == 1 + PFNGLBINDVERTEXARRAYAPPLEPROC glBindVertexArrayAPPLE; + PFNGLDELETEVERTEXARRAYSAPPLEPROC glDeleteVertexArraysAPPLE; + PFNGLGENVERTEXARRAYSAPPLEPROC glGenVertexArraysAPPLE; + PFNGLISVERTEXARRAYAPPLEPROC glIsVertexArrayAPPLE; + #endif + + // Group GL_APPLE_vertex_array_range + #if GL_APPLE_vertex_array_range == 1 + PFNGLVERTEXARRAYRANGEAPPLEPROC glVertexArrayRangeAPPLE; + PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC glFlushVertexArrayRangeAPPLE; + PFNGLVERTEXARRAYPARAMETERIAPPLEPROC glVertexArrayParameteriAPPLE; + #endif + + // Group GL_APPLE_vertex_program_evaluators + #if GL_APPLE_vertex_program_evaluators == 1 + PFNGLENABLEVERTEXATTRIBAPPLEPROC glEnableVertexAttribAPPLE; + PFNGLDISABLEVERTEXATTRIBAPPLEPROC glDisableVertexAttribAPPLE; + PFNGLISVERTEXATTRIBENABLEDAPPLEPROC glIsVertexAttribEnabledAPPLE; + PFNGLMAPVERTEXATTRIB1DAPPLEPROC glMapVertexAttrib1dAPPLE; + PFNGLMAPVERTEXATTRIB1FAPPLEPROC glMapVertexAttrib1fAPPLE; + PFNGLMAPVERTEXATTRIB2DAPPLEPROC glMapVertexAttrib2dAPPLE; + PFNGLMAPVERTEXATTRIB2FAPPLEPROC glMapVertexAttrib2fAPPLE; + #endif + + // Group GL_ATI_draw_buffers + #if GL_ATI_draw_buffers == 1 + PFNGLDRAWBUFFERSATIPROC glDrawBuffersATI; + #endif + + // Group GL_ATI_element_array + #if GL_ATI_element_array == 1 + PFNGLELEMENTPOINTERATIPROC glElementPointerATI; + PFNGLDRAWELEMENTARRAYATIPROC glDrawElementArrayATI; + PFNGLDRAWRANGEELEMENTARRAYATIPROC glDrawRangeElementArrayATI; + #endif + + // Group GL_ATI_envmap_bumpmap + #if GL_ATI_envmap_bumpmap == 1 + PFNGLTEXBUMPPARAMETERIVATIPROC glTexBumpParameterivATI; + PFNGLTEXBUMPPARAMETERFVATIPROC glTexBumpParameterfvATI; + PFNGLGETTEXBUMPPARAMETERIVATIPROC glGetTexBumpParameterivATI; + PFNGLGETTEXBUMPPARAMETERFVATIPROC glGetTexBumpParameterfvATI; + #endif + + // Group GL_ATI_fragment_shader + #if GL_ATI_fragment_shader == 1 + PFNGLGENFRAGMENTSHADERSATIPROC glGenFragmentShadersATI; + PFNGLBINDFRAGMENTSHADERATIPROC glBindFragmentShaderATI; + PFNGLDELETEFRAGMENTSHADERATIPROC glDeleteFragmentShaderATI; + PFNGLBEGINFRAGMENTSHADERATIPROC glBeginFragmentShaderATI; + PFNGLENDFRAGMENTSHADERATIPROC glEndFragmentShaderATI; + PFNGLPASSTEXCOORDATIPROC glPassTexCoordATI; + PFNGLSAMPLEMAPATIPROC glSampleMapATI; + PFNGLCOLORFRAGMENTOP1ATIPROC glColorFragmentOp1ATI; + PFNGLCOLORFRAGMENTOP2ATIPROC glColorFragmentOp2ATI; + PFNGLCOLORFRAGMENTOP3ATIPROC glColorFragmentOp3ATI; + PFNGLALPHAFRAGMENTOP1ATIPROC glAlphaFragmentOp1ATI; + PFNGLALPHAFRAGMENTOP2ATIPROC glAlphaFragmentOp2ATI; + PFNGLALPHAFRAGMENTOP3ATIPROC glAlphaFragmentOp3ATI; + PFNGLSETFRAGMENTSHADERCONSTANTATIPROC glSetFragmentShaderConstantATI; + #endif + + // Group GL_ATI_map_object_buffer + #if GL_ATI_map_object_buffer == 1 + PFNGLMAPOBJECTBUFFERATIPROC glMapObjectBufferATI; + PFNGLUNMAPOBJECTBUFFERATIPROC glUnmapObjectBufferATI; + #endif + + // Group GL_ATI_pn_triangles + #if GL_ATI_pn_triangles == 1 + PFNGLPNTRIANGLESIATIPROC glPNTrianglesiATI; + PFNGLPNTRIANGLESFATIPROC glPNTrianglesfATI; + #endif + + // Group GL_ATI_separate_stencil + #if GL_ATI_separate_stencil == 1 + PFNGLSTENCILOPSEPARATEATIPROC glStencilOpSeparateATI; + PFNGLSTENCILFUNCSEPARATEATIPROC glStencilFuncSeparateATI; + #endif + + // Group GL_ATI_vertex_array_object + #if GL_ATI_vertex_array_object == 1 + PFNGLNEWOBJECTBUFFERATIPROC glNewObjectBufferATI; + PFNGLISOBJECTBUFFERATIPROC glIsObjectBufferATI; + PFNGLUPDATEOBJECTBUFFERATIPROC glUpdateObjectBufferATI; + PFNGLGETOBJECTBUFFERFVATIPROC glGetObjectBufferfvATI; + PFNGLGETOBJECTBUFFERIVATIPROC glGetObjectBufferivATI; + PFNGLFREEOBJECTBUFFERATIPROC glFreeObjectBufferATI; + PFNGLARRAYOBJECTATIPROC glArrayObjectATI; + PFNGLGETARRAYOBJECTFVATIPROC glGetArrayObjectfvATI; + PFNGLGETARRAYOBJECTIVATIPROC glGetArrayObjectivATI; + PFNGLVARIANTARRAYOBJECTATIPROC glVariantArrayObjectATI; + PFNGLGETVARIANTARRAYOBJECTFVATIPROC glGetVariantArrayObjectfvATI; + PFNGLGETVARIANTARRAYOBJECTIVATIPROC glGetVariantArrayObjectivATI; + #endif + + // Group GL_ATI_vertex_attrib_array_object + #if GL_ATI_vertex_attrib_array_object == 1 + PFNGLVERTEXATTRIBARRAYOBJECTATIPROC glVertexAttribArrayObjectATI; + PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC glGetVertexAttribArrayObjectfvATI; + PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC glGetVertexAttribArrayObjectivATI; + #endif + + // Group GL_ATI_vertex_streams + #if GL_ATI_vertex_streams == 1 + PFNGLVERTEXSTREAM1SATIPROC glVertexStream1sATI; + PFNGLVERTEXSTREAM1SVATIPROC glVertexStream1svATI; + PFNGLVERTEXSTREAM1IATIPROC glVertexStream1iATI; + PFNGLVERTEXSTREAM1IVATIPROC glVertexStream1ivATI; + PFNGLVERTEXSTREAM1FATIPROC glVertexStream1fATI; + PFNGLVERTEXSTREAM1FVATIPROC glVertexStream1fvATI; + PFNGLVERTEXSTREAM1DATIPROC glVertexStream1dATI; + PFNGLVERTEXSTREAM1DVATIPROC glVertexStream1dvATI; + PFNGLVERTEXSTREAM2SATIPROC glVertexStream2sATI; + PFNGLVERTEXSTREAM2SVATIPROC glVertexStream2svATI; + PFNGLVERTEXSTREAM2IATIPROC glVertexStream2iATI; + PFNGLVERTEXSTREAM2IVATIPROC glVertexStream2ivATI; + PFNGLVERTEXSTREAM2FATIPROC glVertexStream2fATI; + PFNGLVERTEXSTREAM2FVATIPROC glVertexStream2fvATI; + PFNGLVERTEXSTREAM2DATIPROC glVertexStream2dATI; + PFNGLVERTEXSTREAM2DVATIPROC glVertexStream2dvATI; + PFNGLVERTEXSTREAM3SATIPROC glVertexStream3sATI; + PFNGLVERTEXSTREAM3SVATIPROC glVertexStream3svATI; + PFNGLVERTEXSTREAM3IATIPROC glVertexStream3iATI; + PFNGLVERTEXSTREAM3IVATIPROC glVertexStream3ivATI; + PFNGLVERTEXSTREAM3FATIPROC glVertexStream3fATI; + PFNGLVERTEXSTREAM3FVATIPROC glVertexStream3fvATI; + PFNGLVERTEXSTREAM3DATIPROC glVertexStream3dATI; + PFNGLVERTEXSTREAM3DVATIPROC glVertexStream3dvATI; + PFNGLVERTEXSTREAM4SATIPROC glVertexStream4sATI; + PFNGLVERTEXSTREAM4SVATIPROC glVertexStream4svATI; + PFNGLVERTEXSTREAM4IATIPROC glVertexStream4iATI; + PFNGLVERTEXSTREAM4IVATIPROC glVertexStream4ivATI; + PFNGLVERTEXSTREAM4FATIPROC glVertexStream4fATI; + PFNGLVERTEXSTREAM4FVATIPROC glVertexStream4fvATI; + PFNGLVERTEXSTREAM4DATIPROC glVertexStream4dATI; + PFNGLVERTEXSTREAM4DVATIPROC glVertexStream4dvATI; + PFNGLNORMALSTREAM3BATIPROC glNormalStream3bATI; + PFNGLNORMALSTREAM3BVATIPROC glNormalStream3bvATI; + PFNGLNORMALSTREAM3SATIPROC glNormalStream3sATI; + PFNGLNORMALSTREAM3SVATIPROC glNormalStream3svATI; + PFNGLNORMALSTREAM3IATIPROC glNormalStream3iATI; + PFNGLNORMALSTREAM3IVATIPROC glNormalStream3ivATI; + PFNGLNORMALSTREAM3FATIPROC glNormalStream3fATI; + PFNGLNORMALSTREAM3FVATIPROC glNormalStream3fvATI; + PFNGLNORMALSTREAM3DATIPROC glNormalStream3dATI; + PFNGLNORMALSTREAM3DVATIPROC glNormalStream3dvATI; + PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC glClientActiveVertexStreamATI; + PFNGLVERTEXBLENDENVIATIPROC glVertexBlendEnviATI; + PFNGLVERTEXBLENDENVFATIPROC glVertexBlendEnvfATI; + #endif + + // Group GL_EXT_bindable_uniform + #if GL_EXT_bindable_uniform == 1 + PFNGLUNIFORMBUFFEREXTPROC glUniformBufferEXT; + PFNGLGETUNIFORMBUFFERSIZEEXTPROC glGetUniformBufferSizeEXT; + PFNGLGETUNIFORMOFFSETEXTPROC glGetUniformOffsetEXT; + #endif + + // Group GL_EXT_blend_color + #if GL_EXT_blend_color == 1 + PFNGLBLENDCOLOREXTPROC glBlendColorEXT; + #endif + + // Group GL_EXT_blend_equation_separate + #if GL_EXT_blend_equation_separate == 1 + PFNGLBLENDEQUATIONSEPARATEEXTPROC glBlendEquationSeparateEXT; + #endif + + // Group GL_EXT_blend_func_separate + #if GL_EXT_blend_func_separate == 1 + PFNGLBLENDFUNCSEPARATEEXTPROC glBlendFuncSeparateEXT; + #endif + + // Group GL_EXT_blend_minmax + #if GL_EXT_blend_minmax == 1 + PFNGLBLENDEQUATIONEXTPROC glBlendEquationEXT; + #endif + + // Group GL_EXT_color_subtable + #if GL_EXT_color_subtable == 1 + PFNGLCOLORSUBTABLEEXTPROC glColorSubTableEXT; + PFNGLCOPYCOLORSUBTABLEEXTPROC glCopyColorSubTableEXT; + #endif + + // Group GL_EXT_compiled_vertex_array + #if GL_EXT_compiled_vertex_array == 1 + PFNGLLOCKARRAYSEXTPROC glLockArraysEXT; + PFNGLUNLOCKARRAYSEXTPROC glUnlockArraysEXT; + #endif + + // Group GL_EXT_convolution + #if GL_EXT_convolution == 1 + PFNGLCONVOLUTIONFILTER1DEXTPROC glConvolutionFilter1DEXT; + PFNGLCONVOLUTIONFILTER2DEXTPROC glConvolutionFilter2DEXT; + PFNGLCONVOLUTIONPARAMETERFEXTPROC glConvolutionParameterfEXT; + PFNGLCONVOLUTIONPARAMETERFVEXTPROC glConvolutionParameterfvEXT; + PFNGLCONVOLUTIONPARAMETERIEXTPROC glConvolutionParameteriEXT; + PFNGLCONVOLUTIONPARAMETERIVEXTPROC glConvolutionParameterivEXT; + PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC glCopyConvolutionFilter1DEXT; + PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC glCopyConvolutionFilter2DEXT; + PFNGLGETCONVOLUTIONFILTEREXTPROC glGetConvolutionFilterEXT; + PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC glGetConvolutionParameterfvEXT; + PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC glGetConvolutionParameterivEXT; + PFNGLGETSEPARABLEFILTEREXTPROC glGetSeparableFilterEXT; + PFNGLSEPARABLEFILTER2DEXTPROC glSeparableFilter2DEXT; + #endif + + // Group GL_EXT_coordinate_frame + #if GL_EXT_coordinate_frame == 1 + PFNGLTANGENT3BEXTPROC glTangent3bEXT; + PFNGLTANGENT3BVEXTPROC glTangent3bvEXT; + PFNGLTANGENT3DEXTPROC glTangent3dEXT; + PFNGLTANGENT3DVEXTPROC glTangent3dvEXT; + PFNGLTANGENT3FEXTPROC glTangent3fEXT; + PFNGLTANGENT3FVEXTPROC glTangent3fvEXT; + PFNGLTANGENT3IEXTPROC glTangent3iEXT; + PFNGLTANGENT3IVEXTPROC glTangent3ivEXT; + PFNGLTANGENT3SEXTPROC glTangent3sEXT; + PFNGLTANGENT3SVEXTPROC glTangent3svEXT; + PFNGLBINORMAL3BEXTPROC glBinormal3bEXT; + PFNGLBINORMAL3BVEXTPROC glBinormal3bvEXT; + PFNGLBINORMAL3DEXTPROC glBinormal3dEXT; + PFNGLBINORMAL3DVEXTPROC glBinormal3dvEXT; + PFNGLBINORMAL3FEXTPROC glBinormal3fEXT; + PFNGLBINORMAL3FVEXTPROC glBinormal3fvEXT; + PFNGLBINORMAL3IEXTPROC glBinormal3iEXT; + PFNGLBINORMAL3IVEXTPROC glBinormal3ivEXT; + PFNGLBINORMAL3SEXTPROC glBinormal3sEXT; + PFNGLBINORMAL3SVEXTPROC glBinormal3svEXT; + PFNGLTANGENTPOINTEREXTPROC glTangentPointerEXT; + PFNGLBINORMALPOINTEREXTPROC glBinormalPointerEXT; + #endif + + // Group GL_EXT_copy_texture + #if GL_EXT_copy_texture == 1 + PFNGLCOPYTEXIMAGE1DEXTPROC glCopyTexImage1DEXT; + PFNGLCOPYTEXIMAGE2DEXTPROC glCopyTexImage2DEXT; + PFNGLCOPYTEXSUBIMAGE1DEXTPROC glCopyTexSubImage1DEXT; + PFNGLCOPYTEXSUBIMAGE2DEXTPROC glCopyTexSubImage2DEXT; + PFNGLCOPYTEXSUBIMAGE3DEXTPROC glCopyTexSubImage3DEXT; + #endif + + // Group GL_EXT_cull_vertex + #if GL_EXT_cull_vertex == 1 + PFNGLCULLPARAMETERDVEXTPROC glCullParameterdvEXT; + PFNGLCULLPARAMETERFVEXTPROC glCullParameterfvEXT; + #endif + + // Group GL_EXT_debug_label + #if GL_EXT_debug_label == 1 + PFNGLLABELOBJECTEXTPROC glLabelObjectEXT; + PFNGLGETOBJECTLABELEXTPROC glGetObjectLabelEXT; + #endif + + // Group GL_EXT_debug_marker + #if GL_EXT_debug_marker == 1 + PFNGLINSERTEVENTMARKEREXTPROC glInsertEventMarkerEXT; + PFNGLPUSHGROUPMARKEREXTPROC glPushGroupMarkerEXT; + PFNGLPOPGROUPMARKEREXTPROC glPopGroupMarkerEXT; + #endif + + // Group GL_EXT_depth_bounds_test + #if GL_EXT_depth_bounds_test == 1 + PFNGLDEPTHBOUNDSEXTPROC glDepthBoundsEXT; + #endif + + // Group GL_EXT_direct_state_access + #if GL_EXT_direct_state_access == 1 + PFNGLMATRIXLOADFEXTPROC glMatrixLoadfEXT; + PFNGLMATRIXLOADDEXTPROC glMatrixLoaddEXT; + PFNGLMATRIXMULTFEXTPROC glMatrixMultfEXT; + PFNGLMATRIXMULTDEXTPROC glMatrixMultdEXT; + PFNGLMATRIXLOADIDENTITYEXTPROC glMatrixLoadIdentityEXT; + PFNGLMATRIXROTATEFEXTPROC glMatrixRotatefEXT; + PFNGLMATRIXROTATEDEXTPROC glMatrixRotatedEXT; + PFNGLMATRIXSCALEFEXTPROC glMatrixScalefEXT; + PFNGLMATRIXSCALEDEXTPROC glMatrixScaledEXT; + PFNGLMATRIXTRANSLATEFEXTPROC glMatrixTranslatefEXT; + PFNGLMATRIXTRANSLATEDEXTPROC glMatrixTranslatedEXT; + PFNGLMATRIXFRUSTUMEXTPROC glMatrixFrustumEXT; + PFNGLMATRIXORTHOEXTPROC glMatrixOrthoEXT; + PFNGLMATRIXPOPEXTPROC glMatrixPopEXT; + PFNGLMATRIXPUSHEXTPROC glMatrixPushEXT; + PFNGLCLIENTATTRIBDEFAULTEXTPROC glClientAttribDefaultEXT; + PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC glPushClientAttribDefaultEXT; + PFNGLTEXTUREPARAMETERFEXTPROC glTextureParameterfEXT; + PFNGLTEXTUREPARAMETERFVEXTPROC glTextureParameterfvEXT; + PFNGLTEXTUREPARAMETERIEXTPROC glTextureParameteriEXT; + PFNGLTEXTUREPARAMETERIVEXTPROC glTextureParameterivEXT; + PFNGLTEXTUREIMAGE1DEXTPROC glTextureImage1DEXT; + PFNGLTEXTUREIMAGE2DEXTPROC glTextureImage2DEXT; + PFNGLTEXTURESUBIMAGE1DEXTPROC glTextureSubImage1DEXT; + PFNGLTEXTURESUBIMAGE2DEXTPROC glTextureSubImage2DEXT; + PFNGLCOPYTEXTUREIMAGE1DEXTPROC glCopyTextureImage1DEXT; + PFNGLCOPYTEXTUREIMAGE2DEXTPROC glCopyTextureImage2DEXT; + PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC glCopyTextureSubImage1DEXT; + PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC glCopyTextureSubImage2DEXT; + PFNGLGETTEXTUREIMAGEEXTPROC glGetTextureImageEXT; + PFNGLGETTEXTUREPARAMETERFVEXTPROC glGetTextureParameterfvEXT; + PFNGLGETTEXTUREPARAMETERIVEXTPROC glGetTextureParameterivEXT; + PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC glGetTextureLevelParameterfvEXT; + PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC glGetTextureLevelParameterivEXT; + PFNGLTEXTUREIMAGE3DEXTPROC glTextureImage3DEXT; + PFNGLTEXTURESUBIMAGE3DEXTPROC glTextureSubImage3DEXT; + PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC glCopyTextureSubImage3DEXT; + PFNGLBINDMULTITEXTUREEXTPROC glBindMultiTextureEXT; + PFNGLMULTITEXCOORDPOINTEREXTPROC glMultiTexCoordPointerEXT; + PFNGLMULTITEXENVFEXTPROC glMultiTexEnvfEXT; + PFNGLMULTITEXENVFVEXTPROC glMultiTexEnvfvEXT; + PFNGLMULTITEXENVIEXTPROC glMultiTexEnviEXT; + PFNGLMULTITEXENVIVEXTPROC glMultiTexEnvivEXT; + PFNGLMULTITEXGENDEXTPROC glMultiTexGendEXT; + PFNGLMULTITEXGENDVEXTPROC glMultiTexGendvEXT; + PFNGLMULTITEXGENFEXTPROC glMultiTexGenfEXT; + PFNGLMULTITEXGENFVEXTPROC glMultiTexGenfvEXT; + PFNGLMULTITEXGENIEXTPROC glMultiTexGeniEXT; + PFNGLMULTITEXGENIVEXTPROC glMultiTexGenivEXT; + PFNGLGETMULTITEXENVFVEXTPROC glGetMultiTexEnvfvEXT; + PFNGLGETMULTITEXENVIVEXTPROC glGetMultiTexEnvivEXT; + PFNGLGETMULTITEXGENDVEXTPROC glGetMultiTexGendvEXT; + PFNGLGETMULTITEXGENFVEXTPROC glGetMultiTexGenfvEXT; + PFNGLGETMULTITEXGENIVEXTPROC glGetMultiTexGenivEXT; + PFNGLMULTITEXPARAMETERIEXTPROC glMultiTexParameteriEXT; + PFNGLMULTITEXPARAMETERIVEXTPROC glMultiTexParameterivEXT; + PFNGLMULTITEXPARAMETERFEXTPROC glMultiTexParameterfEXT; + PFNGLMULTITEXPARAMETERFVEXTPROC glMultiTexParameterfvEXT; + PFNGLMULTITEXIMAGE1DEXTPROC glMultiTexImage1DEXT; + PFNGLMULTITEXIMAGE2DEXTPROC glMultiTexImage2DEXT; + PFNGLMULTITEXSUBIMAGE1DEXTPROC glMultiTexSubImage1DEXT; + PFNGLMULTITEXSUBIMAGE2DEXTPROC glMultiTexSubImage2DEXT; + PFNGLCOPYMULTITEXIMAGE1DEXTPROC glCopyMultiTexImage1DEXT; + PFNGLCOPYMULTITEXIMAGE2DEXTPROC glCopyMultiTexImage2DEXT; + PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC glCopyMultiTexSubImage1DEXT; + PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC glCopyMultiTexSubImage2DEXT; + PFNGLGETMULTITEXIMAGEEXTPROC glGetMultiTexImageEXT; + PFNGLGETMULTITEXPARAMETERFVEXTPROC glGetMultiTexParameterfvEXT; + PFNGLGETMULTITEXPARAMETERIVEXTPROC glGetMultiTexParameterivEXT; + PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC glGetMultiTexLevelParameterfvEXT; + PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC glGetMultiTexLevelParameterivEXT; + PFNGLMULTITEXIMAGE3DEXTPROC glMultiTexImage3DEXT; + PFNGLMULTITEXSUBIMAGE3DEXTPROC glMultiTexSubImage3DEXT; + PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC glCopyMultiTexSubImage3DEXT; + PFNGLENABLECLIENTSTATEINDEXEDEXTPROC glEnableClientStateIndexedEXT; + PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC glDisableClientStateIndexedEXT; + PFNGLGETFLOATINDEXEDVEXTPROC glGetFloatIndexedvEXT; + PFNGLGETDOUBLEINDEXEDVEXTPROC glGetDoubleIndexedvEXT; + PFNGLGETPOINTERINDEXEDVEXTPROC glGetPointerIndexedvEXT; + PFNGLENABLEINDEXEDEXTPROC glEnableIndexedEXT; + PFNGLDISABLEINDEXEDEXTPROC glDisableIndexedEXT; + PFNGLISENABLEDINDEXEDEXTPROC glIsEnabledIndexedEXT; + PFNGLGETINTEGERINDEXEDVEXTPROC glGetIntegerIndexedvEXT; + PFNGLGETBOOLEANINDEXEDVEXTPROC glGetBooleanIndexedvEXT; + PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC glCompressedTextureImage3DEXT; + PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC glCompressedTextureImage2DEXT; + PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC glCompressedTextureImage1DEXT; + PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC glCompressedTextureSubImage3DEXT; + PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC glCompressedTextureSubImage2DEXT; + PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC glCompressedTextureSubImage1DEXT; + PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC glGetCompressedTextureImageEXT; + PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC glCompressedMultiTexImage3DEXT; + PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC glCompressedMultiTexImage2DEXT; + PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC glCompressedMultiTexImage1DEXT; + PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC glCompressedMultiTexSubImage3DEXT; + PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC glCompressedMultiTexSubImage2DEXT; + PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC glCompressedMultiTexSubImage1DEXT; + PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC glGetCompressedMultiTexImageEXT; + PFNGLMATRIXLOADTRANSPOSEFEXTPROC glMatrixLoadTransposefEXT; + PFNGLMATRIXLOADTRANSPOSEDEXTPROC glMatrixLoadTransposedEXT; + PFNGLMATRIXMULTTRANSPOSEFEXTPROC glMatrixMultTransposefEXT; + PFNGLMATRIXMULTTRANSPOSEDEXTPROC glMatrixMultTransposedEXT; + PFNGLNAMEDBUFFERDATAEXTPROC glNamedBufferDataEXT; + PFNGLNAMEDBUFFERSUBDATAEXTPROC glNamedBufferSubDataEXT; + PFNGLMAPNAMEDBUFFEREXTPROC glMapNamedBufferEXT; + PFNGLUNMAPNAMEDBUFFEREXTPROC glUnmapNamedBufferEXT; + PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC glGetNamedBufferParameterivEXT; + PFNGLGETNAMEDBUFFERPOINTERVEXTPROC glGetNamedBufferPointervEXT; + PFNGLGETNAMEDBUFFERSUBDATAEXTPROC glGetNamedBufferSubDataEXT; + PFNGLPROGRAMUNIFORM1FEXTPROC glProgramUniform1fEXT; + PFNGLPROGRAMUNIFORM2FEXTPROC glProgramUniform2fEXT; + PFNGLPROGRAMUNIFORM3FEXTPROC glProgramUniform3fEXT; + PFNGLPROGRAMUNIFORM4FEXTPROC glProgramUniform4fEXT; + PFNGLPROGRAMUNIFORM1IEXTPROC glProgramUniform1iEXT; + PFNGLPROGRAMUNIFORM2IEXTPROC glProgramUniform2iEXT; + PFNGLPROGRAMUNIFORM3IEXTPROC glProgramUniform3iEXT; + PFNGLPROGRAMUNIFORM4IEXTPROC glProgramUniform4iEXT; + PFNGLPROGRAMUNIFORM1FVEXTPROC glProgramUniform1fvEXT; + PFNGLPROGRAMUNIFORM2FVEXTPROC glProgramUniform2fvEXT; + PFNGLPROGRAMUNIFORM3FVEXTPROC glProgramUniform3fvEXT; + PFNGLPROGRAMUNIFORM4FVEXTPROC glProgramUniform4fvEXT; + PFNGLPROGRAMUNIFORM1IVEXTPROC glProgramUniform1ivEXT; + PFNGLPROGRAMUNIFORM2IVEXTPROC glProgramUniform2ivEXT; + PFNGLPROGRAMUNIFORM3IVEXTPROC glProgramUniform3ivEXT; + PFNGLPROGRAMUNIFORM4IVEXTPROC glProgramUniform4ivEXT; + PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC glProgramUniformMatrix2fvEXT; + PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC glProgramUniformMatrix3fvEXT; + PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC glProgramUniformMatrix4fvEXT; + PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC glProgramUniformMatrix2x3fvEXT; + PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC glProgramUniformMatrix3x2fvEXT; + PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC glProgramUniformMatrix2x4fvEXT; + PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC glProgramUniformMatrix4x2fvEXT; + PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC glProgramUniformMatrix3x4fvEXT; + PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC glProgramUniformMatrix4x3fvEXT; + PFNGLTEXTUREBUFFEREXTPROC glTextureBufferEXT; + PFNGLMULTITEXBUFFEREXTPROC glMultiTexBufferEXT; + PFNGLTEXTUREPARAMETERIIVEXTPROC glTextureParameterIivEXT; + PFNGLTEXTUREPARAMETERIUIVEXTPROC glTextureParameterIuivEXT; + PFNGLGETTEXTUREPARAMETERIIVEXTPROC glGetTextureParameterIivEXT; + PFNGLGETTEXTUREPARAMETERIUIVEXTPROC glGetTextureParameterIuivEXT; + PFNGLMULTITEXPARAMETERIIVEXTPROC glMultiTexParameterIivEXT; + PFNGLMULTITEXPARAMETERIUIVEXTPROC glMultiTexParameterIuivEXT; + PFNGLGETMULTITEXPARAMETERIIVEXTPROC glGetMultiTexParameterIivEXT; + PFNGLGETMULTITEXPARAMETERIUIVEXTPROC glGetMultiTexParameterIuivEXT; + PFNGLPROGRAMUNIFORM1UIEXTPROC glProgramUniform1uiEXT; + PFNGLPROGRAMUNIFORM2UIEXTPROC glProgramUniform2uiEXT; + PFNGLPROGRAMUNIFORM3UIEXTPROC glProgramUniform3uiEXT; + PFNGLPROGRAMUNIFORM4UIEXTPROC glProgramUniform4uiEXT; + PFNGLPROGRAMUNIFORM1UIVEXTPROC glProgramUniform1uivEXT; + PFNGLPROGRAMUNIFORM2UIVEXTPROC glProgramUniform2uivEXT; + PFNGLPROGRAMUNIFORM3UIVEXTPROC glProgramUniform3uivEXT; + PFNGLPROGRAMUNIFORM4UIVEXTPROC glProgramUniform4uivEXT; + PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC glNamedProgramLocalParameters4fvEXT; + PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC glNamedProgramLocalParameterI4iEXT; + PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC glNamedProgramLocalParameterI4ivEXT; + PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC glNamedProgramLocalParametersI4ivEXT; + PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC glNamedProgramLocalParameterI4uiEXT; + PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC glNamedProgramLocalParameterI4uivEXT; + PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC glNamedProgramLocalParametersI4uivEXT; + PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC glGetNamedProgramLocalParameterIivEXT; + PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC glGetNamedProgramLocalParameterIuivEXT; + PFNGLENABLECLIENTSTATEIEXTPROC glEnableClientStateiEXT; + PFNGLDISABLECLIENTSTATEIEXTPROC glDisableClientStateiEXT; + PFNGLGETFLOATI_VEXTPROC glGetFloati_vEXT; + PFNGLGETDOUBLEI_VEXTPROC glGetDoublei_vEXT; + PFNGLGETPOINTERI_VEXTPROC glGetPointeri_vEXT; + PFNGLNAMEDPROGRAMSTRINGEXTPROC glNamedProgramStringEXT; + PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC glNamedProgramLocalParameter4dEXT; + PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC glNamedProgramLocalParameter4dvEXT; + PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC glNamedProgramLocalParameter4fEXT; + PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC glNamedProgramLocalParameter4fvEXT; + PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC glGetNamedProgramLocalParameterdvEXT; + PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC glGetNamedProgramLocalParameterfvEXT; + PFNGLGETNAMEDPROGRAMIVEXTPROC glGetNamedProgramivEXT; + PFNGLGETNAMEDPROGRAMSTRINGEXTPROC glGetNamedProgramStringEXT; + PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC glNamedRenderbufferStorageEXT; + PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC glGetNamedRenderbufferParameterivEXT; + PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glNamedRenderbufferStorageMultisampleEXT; + PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC glNamedRenderbufferStorageMultisampleCoverageEXT; + PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC glCheckNamedFramebufferStatusEXT; + PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC glNamedFramebufferTexture1DEXT; + PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC glNamedFramebufferTexture2DEXT; + PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC glNamedFramebufferTexture3DEXT; + PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC glNamedFramebufferRenderbufferEXT; + PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetNamedFramebufferAttachmentParameterivEXT; + PFNGLGENERATETEXTUREMIPMAPEXTPROC glGenerateTextureMipmapEXT; + PFNGLGENERATEMULTITEXMIPMAPEXTPROC glGenerateMultiTexMipmapEXT; + PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC glFramebufferDrawBufferEXT; + PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC glFramebufferDrawBuffersEXT; + PFNGLFRAMEBUFFERREADBUFFEREXTPROC glFramebufferReadBufferEXT; + PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC glGetFramebufferParameterivEXT; + PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC glNamedCopyBufferSubDataEXT; + PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC glNamedFramebufferTextureEXT; + PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC glNamedFramebufferTextureLayerEXT; + PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC glNamedFramebufferTextureFaceEXT; + PFNGLTEXTURERENDERBUFFEREXTPROC glTextureRenderbufferEXT; + PFNGLMULTITEXRENDERBUFFEREXTPROC glMultiTexRenderbufferEXT; + PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC glVertexArrayVertexOffsetEXT; + PFNGLVERTEXARRAYCOLOROFFSETEXTPROC glVertexArrayColorOffsetEXT; + PFNGLVERTEXARRAYEDGEFLAGOFFSETEXTPROC glVertexArrayEdgeFlagOffsetEXT; + PFNGLVERTEXARRAYINDEXOFFSETEXTPROC glVertexArrayIndexOffsetEXT; + PFNGLVERTEXARRAYNORMALOFFSETEXTPROC glVertexArrayNormalOffsetEXT; + PFNGLVERTEXARRAYTEXCOORDOFFSETEXTPROC glVertexArrayTexCoordOffsetEXT; + PFNGLVERTEXARRAYMULTITEXCOORDOFFSETEXTPROC glVertexArrayMultiTexCoordOffsetEXT; + PFNGLVERTEXARRAYFOGCOORDOFFSETEXTPROC glVertexArrayFogCoordOffsetEXT; + PFNGLVERTEXARRAYSECONDARYCOLOROFFSETEXTPROC glVertexArraySecondaryColorOffsetEXT; + PFNGLVERTEXARRAYVERTEXATTRIBOFFSETEXTPROC glVertexArrayVertexAttribOffsetEXT; + PFNGLVERTEXARRAYVERTEXATTRIBIOFFSETEXTPROC glVertexArrayVertexAttribIOffsetEXT; + PFNGLENABLEVERTEXARRAYEXTPROC glEnableVertexArrayEXT; + PFNGLDISABLEVERTEXARRAYEXTPROC glDisableVertexArrayEXT; + PFNGLENABLEVERTEXARRAYATTRIBEXTPROC glEnableVertexArrayAttribEXT; + PFNGLDISABLEVERTEXARRAYATTRIBEXTPROC glDisableVertexArrayAttribEXT; + PFNGLGETVERTEXARRAYINTEGERVEXTPROC glGetVertexArrayIntegervEXT; + PFNGLGETVERTEXARRAYPOINTERVEXTPROC glGetVertexArrayPointervEXT; + PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC glGetVertexArrayIntegeri_vEXT; + PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC glGetVertexArrayPointeri_vEXT; + PFNGLMAPNAMEDBUFFERRANGEEXTPROC glMapNamedBufferRangeEXT; + PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC glFlushMappedNamedBufferRangeEXT; + PFNGLNAMEDBUFFERSTORAGEEXTPROC glNamedBufferStorageEXT; + PFNGLCLEARNAMEDBUFFERDATAEXTPROC glClearNamedBufferDataEXT; + PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC glClearNamedBufferSubDataEXT; + PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC glNamedFramebufferParameteriEXT; + PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC glGetNamedFramebufferParameterivEXT; + PFNGLPROGRAMUNIFORM1DEXTPROC glProgramUniform1dEXT; + PFNGLPROGRAMUNIFORM2DEXTPROC glProgramUniform2dEXT; + PFNGLPROGRAMUNIFORM3DEXTPROC glProgramUniform3dEXT; + PFNGLPROGRAMUNIFORM4DEXTPROC glProgramUniform4dEXT; + PFNGLPROGRAMUNIFORM1DVEXTPROC glProgramUniform1dvEXT; + PFNGLPROGRAMUNIFORM2DVEXTPROC glProgramUniform2dvEXT; + PFNGLPROGRAMUNIFORM3DVEXTPROC glProgramUniform3dvEXT; + PFNGLPROGRAMUNIFORM4DVEXTPROC glProgramUniform4dvEXT; + PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC glProgramUniformMatrix2dvEXT; + PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC glProgramUniformMatrix3dvEXT; + PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC glProgramUniformMatrix4dvEXT; + PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC glProgramUniformMatrix2x3dvEXT; + PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC glProgramUniformMatrix2x4dvEXT; + PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC glProgramUniformMatrix3x2dvEXT; + PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC glProgramUniformMatrix3x4dvEXT; + PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC glProgramUniformMatrix4x2dvEXT; + PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC glProgramUniformMatrix4x3dvEXT; + PFNGLTEXTUREBUFFERRANGEEXTPROC glTextureBufferRangeEXT; + PFNGLTEXTURESTORAGE1DEXTPROC glTextureStorage1DEXT; + PFNGLTEXTURESTORAGE2DEXTPROC glTextureStorage2DEXT; + PFNGLTEXTURESTORAGE3DEXTPROC glTextureStorage3DEXT; + PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC glTextureStorage2DMultisampleEXT; + PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC glTextureStorage3DMultisampleEXT; + PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC glVertexArrayBindVertexBufferEXT; + PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC glVertexArrayVertexAttribFormatEXT; + PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC glVertexArrayVertexAttribIFormatEXT; + PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC glVertexArrayVertexAttribLFormatEXT; + PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC glVertexArrayVertexAttribBindingEXT; + PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC glVertexArrayVertexBindingDivisorEXT; + PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC glVertexArrayVertexAttribLOffsetEXT; + PFNGLTEXTUREPAGECOMMITMENTEXTPROC glTexturePageCommitmentEXT; + PFNGLVERTEXARRAYVERTEXATTRIBDIVISOREXTPROC glVertexArrayVertexAttribDivisorEXT; + #endif + + // Group GL_EXT_draw_buffers2 + #if GL_EXT_draw_buffers2 == 1 + PFNGLCOLORMASKINDEXEDEXTPROC glColorMaskIndexedEXT; + #endif + + // Group GL_EXT_draw_instanced + #if GL_EXT_draw_instanced == 1 + PFNGLDRAWARRAYSINSTANCEDEXTPROC glDrawArraysInstancedEXT; + PFNGLDRAWELEMENTSINSTANCEDEXTPROC glDrawElementsInstancedEXT; + #endif + + // Group GL_EXT_draw_range_elements + #if GL_EXT_draw_range_elements == 1 + PFNGLDRAWRANGEELEMENTSEXTPROC glDrawRangeElementsEXT; + #endif + + // Group GL_EXT_fog_coord + #if GL_EXT_fog_coord == 1 + PFNGLFOGCOORDFEXTPROC glFogCoordfEXT; + PFNGLFOGCOORDFVEXTPROC glFogCoordfvEXT; + PFNGLFOGCOORDDEXTPROC glFogCoorddEXT; + PFNGLFOGCOORDDVEXTPROC glFogCoorddvEXT; + PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointerEXT; + #endif + + // Group GL_EXT_framebuffer_blit + #if GL_EXT_framebuffer_blit == 1 + PFNGLBLITFRAMEBUFFEREXTPROC glBlitFramebufferEXT; + #endif + + // Group GL_EXT_framebuffer_multisample + #if GL_EXT_framebuffer_multisample == 1 + PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glRenderbufferStorageMultisampleEXT; + #endif + + // Group GL_EXT_framebuffer_object + #if GL_EXT_framebuffer_object == 1 + PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT; + PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT; + PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT; + PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT; + PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT; + PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT; + PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT; + PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT; + PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT; + PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT; + PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT; + PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT; + PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT; + PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT; + PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT; + PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT; + PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT; + #endif + + // Group GL_EXT_geometry_shader4 + #if GL_EXT_geometry_shader4 == 1 + PFNGLPROGRAMPARAMETERIEXTPROC glProgramParameteriEXT; + #endif + + // Group GL_EXT_gpu_program_parameters + #if GL_EXT_gpu_program_parameters == 1 + PFNGLPROGRAMENVPARAMETERS4FVEXTPROC glProgramEnvParameters4fvEXT; + PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC glProgramLocalParameters4fvEXT; + #endif + + // Group GL_EXT_gpu_shader4 + #if GL_EXT_gpu_shader4 == 1 + PFNGLGETUNIFORMUIVEXTPROC glGetUniformuivEXT; + PFNGLBINDFRAGDATALOCATIONEXTPROC glBindFragDataLocationEXT; + PFNGLGETFRAGDATALOCATIONEXTPROC glGetFragDataLocationEXT; + PFNGLUNIFORM1UIEXTPROC glUniform1uiEXT; + PFNGLUNIFORM2UIEXTPROC glUniform2uiEXT; + PFNGLUNIFORM3UIEXTPROC glUniform3uiEXT; + PFNGLUNIFORM4UIEXTPROC glUniform4uiEXT; + PFNGLUNIFORM1UIVEXTPROC glUniform1uivEXT; + PFNGLUNIFORM2UIVEXTPROC glUniform2uivEXT; + PFNGLUNIFORM3UIVEXTPROC glUniform3uivEXT; + PFNGLUNIFORM4UIVEXTPROC glUniform4uivEXT; + #endif + + // Group GL_EXT_histogram + #if GL_EXT_histogram == 1 + PFNGLGETHISTOGRAMEXTPROC glGetHistogramEXT; + PFNGLGETHISTOGRAMPARAMETERFVEXTPROC glGetHistogramParameterfvEXT; + PFNGLGETHISTOGRAMPARAMETERIVEXTPROC glGetHistogramParameterivEXT; + PFNGLGETMINMAXEXTPROC glGetMinmaxEXT; + PFNGLGETMINMAXPARAMETERFVEXTPROC glGetMinmaxParameterfvEXT; + PFNGLGETMINMAXPARAMETERIVEXTPROC glGetMinmaxParameterivEXT; + PFNGLHISTOGRAMEXTPROC glHistogramEXT; + PFNGLMINMAXEXTPROC glMinmaxEXT; + PFNGLRESETHISTOGRAMEXTPROC glResetHistogramEXT; + PFNGLRESETMINMAXEXTPROC glResetMinmaxEXT; + #endif + + // Group GL_EXT_index_func + #if GL_EXT_index_func == 1 + PFNGLINDEXFUNCEXTPROC glIndexFuncEXT; + #endif + + // Group GL_EXT_index_material + #if GL_EXT_index_material == 1 + PFNGLINDEXMATERIALEXTPROC glIndexMaterialEXT; + #endif + + // Group GL_EXT_light_texture + #if GL_EXT_light_texture == 1 + PFNGLAPPLYTEXTUREEXTPROC glApplyTextureEXT; + PFNGLTEXTURELIGHTEXTPROC glTextureLightEXT; + PFNGLTEXTUREMATERIALEXTPROC glTextureMaterialEXT; + #endif + + // Group GL_EXT_multi_draw_arrays + #if GL_EXT_multi_draw_arrays == 1 + PFNGLMULTIDRAWARRAYSEXTPROC glMultiDrawArraysEXT; + PFNGLMULTIDRAWELEMENTSEXTPROC glMultiDrawElementsEXT; + #endif + + // Group GL_EXT_multisample + #if GL_EXT_multisample == 1 + PFNGLSAMPLEMASKEXTPROC glSampleMaskEXT; + PFNGLSAMPLEPATTERNEXTPROC glSamplePatternEXT; + #endif + + // Group GL_EXT_paletted_texture + #if GL_EXT_paletted_texture == 1 + PFNGLCOLORTABLEEXTPROC glColorTableEXT; + PFNGLGETCOLORTABLEEXTPROC glGetColorTableEXT; + PFNGLGETCOLORTABLEPARAMETERIVEXTPROC glGetColorTableParameterivEXT; + PFNGLGETCOLORTABLEPARAMETERFVEXTPROC glGetColorTableParameterfvEXT; + #endif + + // Group GL_EXT_pixel_transform + #if GL_EXT_pixel_transform == 1 + PFNGLPIXELTRANSFORMPARAMETERIEXTPROC glPixelTransformParameteriEXT; + PFNGLPIXELTRANSFORMPARAMETERFEXTPROC glPixelTransformParameterfEXT; + PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC glPixelTransformParameterivEXT; + PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC glPixelTransformParameterfvEXT; + PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC glGetPixelTransformParameterivEXT; + PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC glGetPixelTransformParameterfvEXT; + #endif + + // Group GL_EXT_point_parameters + #if GL_EXT_point_parameters == 1 + PFNGLPOINTPARAMETERFEXTPROC glPointParameterfEXT; + PFNGLPOINTPARAMETERFVEXTPROC glPointParameterfvEXT; + #endif + + // Group GL_EXT_polygon_offset + #if GL_EXT_polygon_offset == 1 + PFNGLPOLYGONOFFSETEXTPROC glPolygonOffsetEXT; + #endif + + // Group GL_EXT_polygon_offset_clamp + #if GL_EXT_polygon_offset_clamp == 1 + PFNGLPOLYGONOFFSETCLAMPEXTPROC glPolygonOffsetClampEXT; + #endif + + // Group GL_EXT_provoking_vertex + #if GL_EXT_provoking_vertex == 1 + PFNGLPROVOKINGVERTEXEXTPROC glProvokingVertexEXT; + #endif + + // Group GL_EXT_raster_multisample + #if GL_EXT_raster_multisample == 1 + PFNGLRASTERSAMPLESEXTPROC glRasterSamplesEXT; + #endif + + // Group GL_EXT_secondary_color + #if GL_EXT_secondary_color == 1 + PFNGLSECONDARYCOLOR3BEXTPROC glSecondaryColor3bEXT; + PFNGLSECONDARYCOLOR3BVEXTPROC glSecondaryColor3bvEXT; + PFNGLSECONDARYCOLOR3DEXTPROC glSecondaryColor3dEXT; + PFNGLSECONDARYCOLOR3DVEXTPROC glSecondaryColor3dvEXT; + PFNGLSECONDARYCOLOR3FEXTPROC glSecondaryColor3fEXT; + PFNGLSECONDARYCOLOR3FVEXTPROC glSecondaryColor3fvEXT; + PFNGLSECONDARYCOLOR3IEXTPROC glSecondaryColor3iEXT; + PFNGLSECONDARYCOLOR3IVEXTPROC glSecondaryColor3ivEXT; + PFNGLSECONDARYCOLOR3SEXTPROC glSecondaryColor3sEXT; + PFNGLSECONDARYCOLOR3SVEXTPROC glSecondaryColor3svEXT; + PFNGLSECONDARYCOLOR3UBEXTPROC glSecondaryColor3ubEXT; + PFNGLSECONDARYCOLOR3UBVEXTPROC glSecondaryColor3ubvEXT; + PFNGLSECONDARYCOLOR3UIEXTPROC glSecondaryColor3uiEXT; + PFNGLSECONDARYCOLOR3UIVEXTPROC glSecondaryColor3uivEXT; + PFNGLSECONDARYCOLOR3USEXTPROC glSecondaryColor3usEXT; + PFNGLSECONDARYCOLOR3USVEXTPROC glSecondaryColor3usvEXT; + PFNGLSECONDARYCOLORPOINTEREXTPROC glSecondaryColorPointerEXT; + #endif + + // Group GL_EXT_separate_shader_objects + #if GL_EXT_separate_shader_objects == 1 + PFNGLUSESHADERPROGRAMEXTPROC glUseShaderProgramEXT; + PFNGLACTIVEPROGRAMEXTPROC glActiveProgramEXT; + PFNGLCREATESHADERPROGRAMEXTPROC glCreateShaderProgramEXT; + #endif + + // Group GL_EXT_shader_image_load_store + #if GL_EXT_shader_image_load_store == 1 + PFNGLBINDIMAGETEXTUREEXTPROC glBindImageTextureEXT; + PFNGLMEMORYBARRIEREXTPROC glMemoryBarrierEXT; + #endif + + // Group GL_EXT_stencil_clear_tag + #if GL_EXT_stencil_clear_tag == 1 + PFNGLSTENCILCLEARTAGEXTPROC glStencilClearTagEXT; + #endif + + // Group GL_EXT_stencil_two_side + #if GL_EXT_stencil_two_side == 1 + PFNGLACTIVESTENCILFACEEXTPROC glActiveStencilFaceEXT; + #endif + + // Group GL_EXT_subtexture + #if GL_EXT_subtexture == 1 + PFNGLTEXSUBIMAGE1DEXTPROC glTexSubImage1DEXT; + PFNGLTEXSUBIMAGE2DEXTPROC glTexSubImage2DEXT; + #endif + + // Group GL_EXT_texture3D + #if GL_EXT_texture3D == 1 + PFNGLTEXIMAGE3DEXTPROC glTexImage3DEXT; + PFNGLTEXSUBIMAGE3DEXTPROC glTexSubImage3DEXT; + #endif + + // Group GL_EXT_texture_array + #if GL_EXT_texture_array == 1 + PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC glFramebufferTextureLayerEXT; + #endif + + // Group GL_EXT_texture_buffer_object + #if GL_EXT_texture_buffer_object == 1 + PFNGLTEXBUFFEREXTPROC glTexBufferEXT; + #endif + + // Group GL_EXT_texture_integer + #if GL_EXT_texture_integer == 1 + PFNGLTEXPARAMETERIIVEXTPROC glTexParameterIivEXT; + PFNGLTEXPARAMETERIUIVEXTPROC glTexParameterIuivEXT; + PFNGLGETTEXPARAMETERIIVEXTPROC glGetTexParameterIivEXT; + PFNGLGETTEXPARAMETERIUIVEXTPROC glGetTexParameterIuivEXT; + PFNGLCLEARCOLORIIEXTPROC glClearColorIiEXT; + PFNGLCLEARCOLORIUIEXTPROC glClearColorIuiEXT; + #endif + + // Group GL_EXT_texture_object + #if GL_EXT_texture_object == 1 + PFNGLARETEXTURESRESIDENTEXTPROC glAreTexturesResidentEXT; + PFNGLBINDTEXTUREEXTPROC glBindTextureEXT; + PFNGLDELETETEXTURESEXTPROC glDeleteTexturesEXT; + PFNGLGENTEXTURESEXTPROC glGenTexturesEXT; + PFNGLISTEXTUREEXTPROC glIsTextureEXT; + PFNGLPRIORITIZETEXTURESEXTPROC glPrioritizeTexturesEXT; + #endif + + // Group GL_EXT_texture_perturb_normal + #if GL_EXT_texture_perturb_normal == 1 + PFNGLTEXTURENORMALEXTPROC glTextureNormalEXT; + #endif + + // Group GL_EXT_timer_query + #if GL_EXT_timer_query == 1 + PFNGLGETQUERYOBJECTI64VEXTPROC glGetQueryObjecti64vEXT; + PFNGLGETQUERYOBJECTUI64VEXTPROC glGetQueryObjectui64vEXT; + #endif + + // Group GL_EXT_transform_feedback + #if GL_EXT_transform_feedback == 1 + PFNGLBEGINTRANSFORMFEEDBACKEXTPROC glBeginTransformFeedbackEXT; + PFNGLENDTRANSFORMFEEDBACKEXTPROC glEndTransformFeedbackEXT; + PFNGLBINDBUFFERRANGEEXTPROC glBindBufferRangeEXT; + PFNGLBINDBUFFEROFFSETEXTPROC glBindBufferOffsetEXT; + PFNGLBINDBUFFERBASEEXTPROC glBindBufferBaseEXT; + PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC glTransformFeedbackVaryingsEXT; + PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC glGetTransformFeedbackVaryingEXT; + #endif + + // Group GL_EXT_vertex_array + #if GL_EXT_vertex_array == 1 + PFNGLARRAYELEMENTEXTPROC glArrayElementEXT; + PFNGLCOLORPOINTEREXTPROC glColorPointerEXT; + PFNGLDRAWARRAYSEXTPROC glDrawArraysEXT; + PFNGLEDGEFLAGPOINTEREXTPROC glEdgeFlagPointerEXT; + PFNGLGETPOINTERVEXTPROC glGetPointervEXT; + PFNGLINDEXPOINTEREXTPROC glIndexPointerEXT; + PFNGLNORMALPOINTEREXTPROC glNormalPointerEXT; + PFNGLTEXCOORDPOINTEREXTPROC glTexCoordPointerEXT; + PFNGLVERTEXPOINTEREXTPROC glVertexPointerEXT; + #endif + + // Group GL_EXT_vertex_attrib_64bit + #if GL_EXT_vertex_attrib_64bit == 1 + PFNGLVERTEXATTRIBL1DEXTPROC glVertexAttribL1dEXT; + PFNGLVERTEXATTRIBL2DEXTPROC glVertexAttribL2dEXT; + PFNGLVERTEXATTRIBL3DEXTPROC glVertexAttribL3dEXT; + PFNGLVERTEXATTRIBL4DEXTPROC glVertexAttribL4dEXT; + PFNGLVERTEXATTRIBL1DVEXTPROC glVertexAttribL1dvEXT; + PFNGLVERTEXATTRIBL2DVEXTPROC glVertexAttribL2dvEXT; + PFNGLVERTEXATTRIBL3DVEXTPROC glVertexAttribL3dvEXT; + PFNGLVERTEXATTRIBL4DVEXTPROC glVertexAttribL4dvEXT; + PFNGLVERTEXATTRIBLPOINTEREXTPROC glVertexAttribLPointerEXT; + PFNGLGETVERTEXATTRIBLDVEXTPROC glGetVertexAttribLdvEXT; + #endif + + // Group GL_EXT_vertex_shader + #if GL_EXT_vertex_shader == 1 + PFNGLBEGINVERTEXSHADEREXTPROC glBeginVertexShaderEXT; + PFNGLENDVERTEXSHADEREXTPROC glEndVertexShaderEXT; + PFNGLBINDVERTEXSHADEREXTPROC glBindVertexShaderEXT; + PFNGLGENVERTEXSHADERSEXTPROC glGenVertexShadersEXT; + PFNGLDELETEVERTEXSHADEREXTPROC glDeleteVertexShaderEXT; + PFNGLSHADEROP1EXTPROC glShaderOp1EXT; + PFNGLSHADEROP2EXTPROC glShaderOp2EXT; + PFNGLSHADEROP3EXTPROC glShaderOp3EXT; + PFNGLSWIZZLEEXTPROC glSwizzleEXT; + PFNGLWRITEMASKEXTPROC glWriteMaskEXT; + PFNGLINSERTCOMPONENTEXTPROC glInsertComponentEXT; + PFNGLEXTRACTCOMPONENTEXTPROC glExtractComponentEXT; + PFNGLGENSYMBOLSEXTPROC glGenSymbolsEXT; + PFNGLSETINVARIANTEXTPROC glSetInvariantEXT; + PFNGLSETLOCALCONSTANTEXTPROC glSetLocalConstantEXT; + PFNGLVARIANTBVEXTPROC glVariantbvEXT; + PFNGLVARIANTSVEXTPROC glVariantsvEXT; + PFNGLVARIANTIVEXTPROC glVariantivEXT; + PFNGLVARIANTFVEXTPROC glVariantfvEXT; + PFNGLVARIANTDVEXTPROC glVariantdvEXT; + PFNGLVARIANTUBVEXTPROC glVariantubvEXT; + PFNGLVARIANTUSVEXTPROC glVariantusvEXT; + PFNGLVARIANTUIVEXTPROC glVariantuivEXT; + PFNGLVARIANTPOINTEREXTPROC glVariantPointerEXT; + PFNGLENABLEVARIANTCLIENTSTATEEXTPROC glEnableVariantClientStateEXT; + PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC glDisableVariantClientStateEXT; + PFNGLBINDLIGHTPARAMETEREXTPROC glBindLightParameterEXT; + PFNGLBINDMATERIALPARAMETEREXTPROC glBindMaterialParameterEXT; + PFNGLBINDTEXGENPARAMETEREXTPROC glBindTexGenParameterEXT; + PFNGLBINDTEXTUREUNITPARAMETEREXTPROC glBindTextureUnitParameterEXT; + PFNGLBINDPARAMETEREXTPROC glBindParameterEXT; + PFNGLISVARIANTENABLEDEXTPROC glIsVariantEnabledEXT; + PFNGLGETVARIANTBOOLEANVEXTPROC glGetVariantBooleanvEXT; + PFNGLGETVARIANTINTEGERVEXTPROC glGetVariantIntegervEXT; + PFNGLGETVARIANTFLOATVEXTPROC glGetVariantFloatvEXT; + PFNGLGETVARIANTPOINTERVEXTPROC glGetVariantPointervEXT; + PFNGLGETINVARIANTBOOLEANVEXTPROC glGetInvariantBooleanvEXT; + PFNGLGETINVARIANTINTEGERVEXTPROC glGetInvariantIntegervEXT; + PFNGLGETINVARIANTFLOATVEXTPROC glGetInvariantFloatvEXT; + PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC glGetLocalConstantBooleanvEXT; + PFNGLGETLOCALCONSTANTINTEGERVEXTPROC glGetLocalConstantIntegervEXT; + PFNGLGETLOCALCONSTANTFLOATVEXTPROC glGetLocalConstantFloatvEXT; + #endif + + // Group GL_EXT_vertex_weighting + #if GL_EXT_vertex_weighting == 1 + PFNGLVERTEXWEIGHTFEXTPROC glVertexWeightfEXT; + PFNGLVERTEXWEIGHTFVEXTPROC glVertexWeightfvEXT; + PFNGLVERTEXWEIGHTPOINTEREXTPROC glVertexWeightPointerEXT; + #endif + + // Group GL_EXT_x11_sync_object + #if GL_EXT_x11_sync_object == 1 + PFNGLIMPORTSYNCEXTPROC glImportSyncEXT; + #endif + + // Group GL_GREMEDY_frame_terminator + #if GL_GREMEDY_frame_terminator == 1 + PFNGLFRAMETERMINATORGREMEDYPROC glFrameTerminatorGREMEDY; + #endif + + // Group GL_GREMEDY_string_marker + #if GL_GREMEDY_string_marker == 1 + PFNGLSTRINGMARKERGREMEDYPROC glStringMarkerGREMEDY; + #endif + + // Group GL_HP_image_transform + #if GL_HP_image_transform == 1 + PFNGLIMAGETRANSFORMPARAMETERIHPPROC glImageTransformParameteriHP; + PFNGLIMAGETRANSFORMPARAMETERFHPPROC glImageTransformParameterfHP; + PFNGLIMAGETRANSFORMPARAMETERIVHPPROC glImageTransformParameterivHP; + PFNGLIMAGETRANSFORMPARAMETERFVHPPROC glImageTransformParameterfvHP; + PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC glGetImageTransformParameterivHP; + PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC glGetImageTransformParameterfvHP; + #endif + + // Group GL_IBM_multimode_draw_arrays + #if GL_IBM_multimode_draw_arrays == 1 + PFNGLMULTIMODEDRAWARRAYSIBMPROC glMultiModeDrawArraysIBM; + PFNGLMULTIMODEDRAWELEMENTSIBMPROC glMultiModeDrawElementsIBM; + #endif + + // Group GL_IBM_static_data + #if GL_IBM_static_data == 1 + PFNGLFLUSHSTATICDATAIBMPROC glFlushStaticDataIBM; + #endif + + // Group GL_IBM_vertex_array_lists + #if GL_IBM_vertex_array_lists == 1 + PFNGLCOLORPOINTERLISTIBMPROC glColorPointerListIBM; + PFNGLSECONDARYCOLORPOINTERLISTIBMPROC glSecondaryColorPointerListIBM; + PFNGLEDGEFLAGPOINTERLISTIBMPROC glEdgeFlagPointerListIBM; + PFNGLFOGCOORDPOINTERLISTIBMPROC glFogCoordPointerListIBM; + PFNGLINDEXPOINTERLISTIBMPROC glIndexPointerListIBM; + PFNGLNORMALPOINTERLISTIBMPROC glNormalPointerListIBM; + PFNGLTEXCOORDPOINTERLISTIBMPROC glTexCoordPointerListIBM; + PFNGLVERTEXPOINTERLISTIBMPROC glVertexPointerListIBM; + #endif + + // Group GL_INGR_blend_func_separate + #if GL_INGR_blend_func_separate == 1 + PFNGLBLENDFUNCSEPARATEINGRPROC glBlendFuncSeparateINGR; + #endif + + // Group GL_INTEL_map_texture + #if GL_INTEL_map_texture == 1 + PFNGLSYNCTEXTUREINTELPROC glSyncTextureINTEL; + PFNGLUNMAPTEXTURE2DINTELPROC glUnmapTexture2DINTEL; + PFNGLMAPTEXTURE2DINTELPROC glMapTexture2DINTEL; + #endif + + // Group GL_INTEL_parallel_arrays + #if GL_INTEL_parallel_arrays == 1 + PFNGLVERTEXPOINTERVINTELPROC glVertexPointervINTEL; + PFNGLNORMALPOINTERVINTELPROC glNormalPointervINTEL; + PFNGLCOLORPOINTERVINTELPROC glColorPointervINTEL; + PFNGLTEXCOORDPOINTERVINTELPROC glTexCoordPointervINTEL; + #endif + + // Group GL_INTEL_performance_query + #if GL_INTEL_performance_query == 1 + PFNGLBEGINPERFQUERYINTELPROC glBeginPerfQueryINTEL; + PFNGLCREATEPERFQUERYINTELPROC glCreatePerfQueryINTEL; + PFNGLDELETEPERFQUERYINTELPROC glDeletePerfQueryINTEL; + PFNGLENDPERFQUERYINTELPROC glEndPerfQueryINTEL; + PFNGLGETFIRSTPERFQUERYIDINTELPROC glGetFirstPerfQueryIdINTEL; + PFNGLGETNEXTPERFQUERYIDINTELPROC glGetNextPerfQueryIdINTEL; + PFNGLGETPERFCOUNTERINFOINTELPROC glGetPerfCounterInfoINTEL; + PFNGLGETPERFQUERYDATAINTELPROC glGetPerfQueryDataINTEL; + PFNGLGETPERFQUERYIDBYNAMEINTELPROC glGetPerfQueryIdByNameINTEL; + PFNGLGETPERFQUERYINFOINTELPROC glGetPerfQueryInfoINTEL; + #endif + + // Group GL_MESA_resize_buffers + #if GL_MESA_resize_buffers == 1 + PFNGLRESIZEBUFFERSMESAPROC glResizeBuffersMESA; + #endif + + // Group GL_MESA_window_pos + #if GL_MESA_window_pos == 1 + PFNGLWINDOWPOS2DMESAPROC glWindowPos2dMESA; + PFNGLWINDOWPOS2DVMESAPROC glWindowPos2dvMESA; + PFNGLWINDOWPOS2FMESAPROC glWindowPos2fMESA; + PFNGLWINDOWPOS2FVMESAPROC glWindowPos2fvMESA; + PFNGLWINDOWPOS2IMESAPROC glWindowPos2iMESA; + PFNGLWINDOWPOS2IVMESAPROC glWindowPos2ivMESA; + PFNGLWINDOWPOS2SMESAPROC glWindowPos2sMESA; + PFNGLWINDOWPOS2SVMESAPROC glWindowPos2svMESA; + PFNGLWINDOWPOS3DMESAPROC glWindowPos3dMESA; + PFNGLWINDOWPOS3DVMESAPROC glWindowPos3dvMESA; + PFNGLWINDOWPOS3FMESAPROC glWindowPos3fMESA; + PFNGLWINDOWPOS3FVMESAPROC glWindowPos3fvMESA; + PFNGLWINDOWPOS3IMESAPROC glWindowPos3iMESA; + PFNGLWINDOWPOS3IVMESAPROC glWindowPos3ivMESA; + PFNGLWINDOWPOS3SMESAPROC glWindowPos3sMESA; + PFNGLWINDOWPOS3SVMESAPROC glWindowPos3svMESA; + PFNGLWINDOWPOS4DMESAPROC glWindowPos4dMESA; + PFNGLWINDOWPOS4DVMESAPROC glWindowPos4dvMESA; + PFNGLWINDOWPOS4FMESAPROC glWindowPos4fMESA; + PFNGLWINDOWPOS4FVMESAPROC glWindowPos4fvMESA; + PFNGLWINDOWPOS4IMESAPROC glWindowPos4iMESA; + PFNGLWINDOWPOS4IVMESAPROC glWindowPos4ivMESA; + PFNGLWINDOWPOS4SMESAPROC glWindowPos4sMESA; + PFNGLWINDOWPOS4SVMESAPROC glWindowPos4svMESA; + #endif + + // Group GL_NVX_conditional_render + #if GL_NVX_conditional_render == 1 + PFNGLBEGINCONDITIONALRENDERNVXPROC glBeginConditionalRenderNVX; + PFNGLENDCONDITIONALRENDERNVXPROC glEndConditionalRenderNVX; + #endif + + // Group GL_NV_bindless_multi_draw_indirect + #if GL_NV_bindless_multi_draw_indirect == 1 + PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSNVPROC glMultiDrawArraysIndirectBindlessNV; + PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSNVPROC glMultiDrawElementsIndirectBindlessNV; + #endif + + // Group GL_NV_bindless_multi_draw_indirect_count + #if GL_NV_bindless_multi_draw_indirect_count == 1 + PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSCOUNTNVPROC glMultiDrawArraysIndirectBindlessCountNV; + PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSCOUNTNVPROC glMultiDrawElementsIndirectBindlessCountNV; + #endif + + // Group GL_NV_bindless_texture + #if GL_NV_bindless_texture == 1 + PFNGLGETTEXTUREHANDLENVPROC glGetTextureHandleNV; + PFNGLGETTEXTURESAMPLERHANDLENVPROC glGetTextureSamplerHandleNV; + PFNGLMAKETEXTUREHANDLERESIDENTNVPROC glMakeTextureHandleResidentNV; + PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC glMakeTextureHandleNonResidentNV; + PFNGLGETIMAGEHANDLENVPROC glGetImageHandleNV; + PFNGLMAKEIMAGEHANDLERESIDENTNVPROC glMakeImageHandleResidentNV; + PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC glMakeImageHandleNonResidentNV; + PFNGLUNIFORMHANDLEUI64NVPROC glUniformHandleui64NV; + PFNGLUNIFORMHANDLEUI64VNVPROC glUniformHandleui64vNV; + PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC glProgramUniformHandleui64NV; + PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC glProgramUniformHandleui64vNV; + PFNGLISTEXTUREHANDLERESIDENTNVPROC glIsTextureHandleResidentNV; + PFNGLISIMAGEHANDLERESIDENTNVPROC glIsImageHandleResidentNV; + #endif + + // Group GL_NV_blend_equation_advanced + #if GL_NV_blend_equation_advanced == 1 + PFNGLBLENDPARAMETERINVPROC glBlendParameteriNV; + PFNGLBLENDBARRIERNVPROC glBlendBarrierNV; + #endif + + // Group GL_NV_command_list + #if GL_NV_command_list == 1 + PFNGLCREATESTATESNVPROC glCreateStatesNV; + PFNGLDELETESTATESNVPROC glDeleteStatesNV; + PFNGLISSTATENVPROC glIsStateNV; + PFNGLSTATECAPTURENVPROC glStateCaptureNV; + PFNGLGETCOMMANDHEADERNVPROC glGetCommandHeaderNV; + PFNGLGETSTAGEINDEXNVPROC glGetStageIndexNV; + PFNGLDRAWCOMMANDSNVPROC glDrawCommandsNV; + PFNGLDRAWCOMMANDSADDRESSNVPROC glDrawCommandsAddressNV; + PFNGLDRAWCOMMANDSSTATESNVPROC glDrawCommandsStatesNV; + PFNGLDRAWCOMMANDSSTATESADDRESSNVPROC glDrawCommandsStatesAddressNV; + PFNGLCREATECOMMANDLISTSNVPROC glCreateCommandListsNV; + PFNGLDELETECOMMANDLISTSNVPROC glDeleteCommandListsNV; + PFNGLISCOMMANDLISTNVPROC glIsCommandListNV; + PFNGLLISTDRAWCOMMANDSSTATESCLIENTNVPROC glListDrawCommandsStatesClientNV; + PFNGLCOMMANDLISTSEGMENTSNVPROC glCommandListSegmentsNV; + PFNGLCOMPILECOMMANDLISTNVPROC glCompileCommandListNV; + PFNGLCALLCOMMANDLISTNVPROC glCallCommandListNV; + #endif + + // Group GL_NV_conditional_render + #if GL_NV_conditional_render == 1 + PFNGLBEGINCONDITIONALRENDERNVPROC glBeginConditionalRenderNV; + PFNGLENDCONDITIONALRENDERNVPROC glEndConditionalRenderNV; + #endif + + // Group GL_NV_conservative_raster + #if GL_NV_conservative_raster == 1 + PFNGLSUBPIXELPRECISIONBIASNVPROC glSubpixelPrecisionBiasNV; + #endif + + // Group GL_NV_copy_image + #if GL_NV_copy_image == 1 + PFNGLCOPYIMAGESUBDATANVPROC glCopyImageSubDataNV; + #endif + + // Group GL_NV_depth_buffer_float + #if GL_NV_depth_buffer_float == 1 + PFNGLDEPTHRANGEDNVPROC glDepthRangedNV; + PFNGLCLEARDEPTHDNVPROC glClearDepthdNV; + PFNGLDEPTHBOUNDSDNVPROC glDepthBoundsdNV; + #endif + + // Group GL_NV_draw_texture + #if GL_NV_draw_texture == 1 + PFNGLDRAWTEXTURENVPROC glDrawTextureNV; + #endif + + // Group GL_NV_evaluators + #if GL_NV_evaluators == 1 + PFNGLMAPCONTROLPOINTSNVPROC glMapControlPointsNV; + PFNGLMAPPARAMETERIVNVPROC glMapParameterivNV; + PFNGLMAPPARAMETERFVNVPROC glMapParameterfvNV; + PFNGLGETMAPCONTROLPOINTSNVPROC glGetMapControlPointsNV; + PFNGLGETMAPPARAMETERIVNVPROC glGetMapParameterivNV; + PFNGLGETMAPPARAMETERFVNVPROC glGetMapParameterfvNV; + PFNGLGETMAPATTRIBPARAMETERIVNVPROC glGetMapAttribParameterivNV; + PFNGLGETMAPATTRIBPARAMETERFVNVPROC glGetMapAttribParameterfvNV; + PFNGLEVALMAPSNVPROC glEvalMapsNV; + #endif + + // Group GL_NV_explicit_multisample + #if GL_NV_explicit_multisample == 1 + PFNGLGETMULTISAMPLEFVNVPROC glGetMultisamplefvNV; + PFNGLSAMPLEMASKINDEXEDNVPROC glSampleMaskIndexedNV; + PFNGLTEXRENDERBUFFERNVPROC glTexRenderbufferNV; + #endif + + // Group GL_NV_fence + #if GL_NV_fence == 1 + PFNGLDELETEFENCESNVPROC glDeleteFencesNV; + PFNGLGENFENCESNVPROC glGenFencesNV; + PFNGLISFENCENVPROC glIsFenceNV; + PFNGLTESTFENCENVPROC glTestFenceNV; + PFNGLGETFENCEIVNVPROC glGetFenceivNV; + PFNGLFINISHFENCENVPROC glFinishFenceNV; + PFNGLSETFENCENVPROC glSetFenceNV; + #endif + + // Group GL_NV_fragment_coverage_to_color + #if GL_NV_fragment_coverage_to_color == 1 + PFNGLFRAGMENTCOVERAGECOLORNVPROC glFragmentCoverageColorNV; + #endif + + // Group GL_NV_fragment_program + #if GL_NV_fragment_program == 1 + PFNGLPROGRAMNAMEDPARAMETER4FNVPROC glProgramNamedParameter4fNV; + PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC glProgramNamedParameter4fvNV; + PFNGLPROGRAMNAMEDPARAMETER4DNVPROC glProgramNamedParameter4dNV; + PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC glProgramNamedParameter4dvNV; + PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC glGetProgramNamedParameterfvNV; + PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC glGetProgramNamedParameterdvNV; + #endif + + // Group GL_NV_framebuffer_mixed_samples + #if GL_NV_framebuffer_mixed_samples == 1 + PFNGLCOVERAGEMODULATIONTABLENVPROC glCoverageModulationTableNV; + PFNGLGETCOVERAGEMODULATIONTABLENVPROC glGetCoverageModulationTableNV; + PFNGLCOVERAGEMODULATIONNVPROC glCoverageModulationNV; + #endif + + // Group GL_NV_framebuffer_multisample_coverage + #if GL_NV_framebuffer_multisample_coverage == 1 + PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC glRenderbufferStorageMultisampleCoverageNV; + #endif + + // Group GL_NV_geometry_program4 + #if GL_NV_geometry_program4 == 1 + PFNGLPROGRAMVERTEXLIMITNVPROC glProgramVertexLimitNV; + PFNGLFRAMEBUFFERTEXTUREEXTPROC glFramebufferTextureEXT; + PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC glFramebufferTextureFaceEXT; + #endif + + // Group GL_NV_gpu_program4 + #if GL_NV_gpu_program4 == 1 + PFNGLPROGRAMLOCALPARAMETERI4INVPROC glProgramLocalParameterI4iNV; + PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC glProgramLocalParameterI4ivNV; + PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC glProgramLocalParametersI4ivNV; + PFNGLPROGRAMLOCALPARAMETERI4UINVPROC glProgramLocalParameterI4uiNV; + PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC glProgramLocalParameterI4uivNV; + PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC glProgramLocalParametersI4uivNV; + PFNGLPROGRAMENVPARAMETERI4INVPROC glProgramEnvParameterI4iNV; + PFNGLPROGRAMENVPARAMETERI4IVNVPROC glProgramEnvParameterI4ivNV; + PFNGLPROGRAMENVPARAMETERSI4IVNVPROC glProgramEnvParametersI4ivNV; + PFNGLPROGRAMENVPARAMETERI4UINVPROC glProgramEnvParameterI4uiNV; + PFNGLPROGRAMENVPARAMETERI4UIVNVPROC glProgramEnvParameterI4uivNV; + PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC glProgramEnvParametersI4uivNV; + PFNGLGETPROGRAMLOCALPARAMETERIIVNVPROC glGetProgramLocalParameterIivNV; + PFNGLGETPROGRAMLOCALPARAMETERIUIVNVPROC glGetProgramLocalParameterIuivNV; + PFNGLGETPROGRAMENVPARAMETERIIVNVPROC glGetProgramEnvParameterIivNV; + PFNGLGETPROGRAMENVPARAMETERIUIVNVPROC glGetProgramEnvParameterIuivNV; + #endif + + // Group GL_NV_gpu_program5 + #if GL_NV_gpu_program5 == 1 + PFNGLPROGRAMSUBROUTINEPARAMETERSUIVNVPROC glProgramSubroutineParametersuivNV; + PFNGLGETPROGRAMSUBROUTINEPARAMETERUIVNVPROC glGetProgramSubroutineParameteruivNV; + #endif + + // Group GL_NV_half_float + #if GL_NV_half_float == 1 + PFNGLVERTEX2HNVPROC glVertex2hNV; + PFNGLVERTEX2HVNVPROC glVertex2hvNV; + PFNGLVERTEX3HNVPROC glVertex3hNV; + PFNGLVERTEX3HVNVPROC glVertex3hvNV; + PFNGLVERTEX4HNVPROC glVertex4hNV; + PFNGLVERTEX4HVNVPROC glVertex4hvNV; + PFNGLNORMAL3HNVPROC glNormal3hNV; + PFNGLNORMAL3HVNVPROC glNormal3hvNV; + PFNGLCOLOR3HNVPROC glColor3hNV; + PFNGLCOLOR3HVNVPROC glColor3hvNV; + PFNGLCOLOR4HNVPROC glColor4hNV; + PFNGLCOLOR4HVNVPROC glColor4hvNV; + PFNGLTEXCOORD1HNVPROC glTexCoord1hNV; + PFNGLTEXCOORD1HVNVPROC glTexCoord1hvNV; + PFNGLTEXCOORD2HNVPROC glTexCoord2hNV; + PFNGLTEXCOORD2HVNVPROC glTexCoord2hvNV; + PFNGLTEXCOORD3HNVPROC glTexCoord3hNV; + PFNGLTEXCOORD3HVNVPROC glTexCoord3hvNV; + PFNGLTEXCOORD4HNVPROC glTexCoord4hNV; + PFNGLTEXCOORD4HVNVPROC glTexCoord4hvNV; + PFNGLMULTITEXCOORD1HNVPROC glMultiTexCoord1hNV; + PFNGLMULTITEXCOORD1HVNVPROC glMultiTexCoord1hvNV; + PFNGLMULTITEXCOORD2HNVPROC glMultiTexCoord2hNV; + PFNGLMULTITEXCOORD2HVNVPROC glMultiTexCoord2hvNV; + PFNGLMULTITEXCOORD3HNVPROC glMultiTexCoord3hNV; + PFNGLMULTITEXCOORD3HVNVPROC glMultiTexCoord3hvNV; + PFNGLMULTITEXCOORD4HNVPROC glMultiTexCoord4hNV; + PFNGLMULTITEXCOORD4HVNVPROC glMultiTexCoord4hvNV; + PFNGLFOGCOORDHNVPROC glFogCoordhNV; + PFNGLFOGCOORDHVNVPROC glFogCoordhvNV; + PFNGLSECONDARYCOLOR3HNVPROC glSecondaryColor3hNV; + PFNGLSECONDARYCOLOR3HVNVPROC glSecondaryColor3hvNV; + PFNGLVERTEXWEIGHTHNVPROC glVertexWeighthNV; + PFNGLVERTEXWEIGHTHVNVPROC glVertexWeighthvNV; + PFNGLVERTEXATTRIB1HNVPROC glVertexAttrib1hNV; + PFNGLVERTEXATTRIB1HVNVPROC glVertexAttrib1hvNV; + PFNGLVERTEXATTRIB2HNVPROC glVertexAttrib2hNV; + PFNGLVERTEXATTRIB2HVNVPROC glVertexAttrib2hvNV; + PFNGLVERTEXATTRIB3HNVPROC glVertexAttrib3hNV; + PFNGLVERTEXATTRIB3HVNVPROC glVertexAttrib3hvNV; + PFNGLVERTEXATTRIB4HNVPROC glVertexAttrib4hNV; + PFNGLVERTEXATTRIB4HVNVPROC glVertexAttrib4hvNV; + PFNGLVERTEXATTRIBS1HVNVPROC glVertexAttribs1hvNV; + PFNGLVERTEXATTRIBS2HVNVPROC glVertexAttribs2hvNV; + PFNGLVERTEXATTRIBS3HVNVPROC glVertexAttribs3hvNV; + PFNGLVERTEXATTRIBS4HVNVPROC glVertexAttribs4hvNV; + #endif + + // Group GL_NV_internalformat_sample_query + #if GL_NV_internalformat_sample_query == 1 + PFNGLGETINTERNALFORMATSAMPLEIVNVPROC glGetInternalformatSampleivNV; + #endif + + // Group GL_NV_occlusion_query + #if GL_NV_occlusion_query == 1 + PFNGLGENOCCLUSIONQUERIESNVPROC glGenOcclusionQueriesNV; + PFNGLDELETEOCCLUSIONQUERIESNVPROC glDeleteOcclusionQueriesNV; + PFNGLISOCCLUSIONQUERYNVPROC glIsOcclusionQueryNV; + PFNGLBEGINOCCLUSIONQUERYNVPROC glBeginOcclusionQueryNV; + PFNGLENDOCCLUSIONQUERYNVPROC glEndOcclusionQueryNV; + PFNGLGETOCCLUSIONQUERYIVNVPROC glGetOcclusionQueryivNV; + PFNGLGETOCCLUSIONQUERYUIVNVPROC glGetOcclusionQueryuivNV; + #endif + + // Group GL_NV_parameter_buffer_object + #if GL_NV_parameter_buffer_object == 1 + PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC glProgramBufferParametersfvNV; + PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC glProgramBufferParametersIivNV; + PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC glProgramBufferParametersIuivNV; + #endif + + // Group GL_NV_path_rendering + #if GL_NV_path_rendering == 1 + PFNGLGENPATHSNVPROC glGenPathsNV; + PFNGLDELETEPATHSNVPROC glDeletePathsNV; + PFNGLISPATHNVPROC glIsPathNV; + PFNGLPATHCOMMANDSNVPROC glPathCommandsNV; + PFNGLPATHCOORDSNVPROC glPathCoordsNV; + PFNGLPATHSUBCOMMANDSNVPROC glPathSubCommandsNV; + PFNGLPATHSUBCOORDSNVPROC glPathSubCoordsNV; + PFNGLPATHSTRINGNVPROC glPathStringNV; + PFNGLPATHGLYPHSNVPROC glPathGlyphsNV; + PFNGLPATHGLYPHRANGENVPROC glPathGlyphRangeNV; + PFNGLWEIGHTPATHSNVPROC glWeightPathsNV; + PFNGLCOPYPATHNVPROC glCopyPathNV; + PFNGLINTERPOLATEPATHSNVPROC glInterpolatePathsNV; + PFNGLTRANSFORMPATHNVPROC glTransformPathNV; + PFNGLPATHPARAMETERIVNVPROC glPathParameterivNV; + PFNGLPATHPARAMETERINVPROC glPathParameteriNV; + PFNGLPATHPARAMETERFVNVPROC glPathParameterfvNV; + PFNGLPATHPARAMETERFNVPROC glPathParameterfNV; + PFNGLPATHDASHARRAYNVPROC glPathDashArrayNV; + PFNGLPATHSTENCILFUNCNVPROC glPathStencilFuncNV; + PFNGLPATHSTENCILDEPTHOFFSETNVPROC glPathStencilDepthOffsetNV; + PFNGLSTENCILFILLPATHNVPROC glStencilFillPathNV; + PFNGLSTENCILSTROKEPATHNVPROC glStencilStrokePathNV; + PFNGLSTENCILFILLPATHINSTANCEDNVPROC glStencilFillPathInstancedNV; + PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC glStencilStrokePathInstancedNV; + PFNGLPATHCOVERDEPTHFUNCNVPROC glPathCoverDepthFuncNV; + PFNGLCOVERFILLPATHNVPROC glCoverFillPathNV; + PFNGLCOVERSTROKEPATHNVPROC glCoverStrokePathNV; + PFNGLCOVERFILLPATHINSTANCEDNVPROC glCoverFillPathInstancedNV; + PFNGLCOVERSTROKEPATHINSTANCEDNVPROC glCoverStrokePathInstancedNV; + PFNGLGETPATHPARAMETERIVNVPROC glGetPathParameterivNV; + PFNGLGETPATHPARAMETERFVNVPROC glGetPathParameterfvNV; + PFNGLGETPATHCOMMANDSNVPROC glGetPathCommandsNV; + PFNGLGETPATHCOORDSNVPROC glGetPathCoordsNV; + PFNGLGETPATHDASHARRAYNVPROC glGetPathDashArrayNV; + PFNGLGETPATHMETRICSNVPROC glGetPathMetricsNV; + PFNGLGETPATHMETRICRANGENVPROC glGetPathMetricRangeNV; + PFNGLGETPATHSPACINGNVPROC glGetPathSpacingNV; + PFNGLISPOINTINFILLPATHNVPROC glIsPointInFillPathNV; + PFNGLISPOINTINSTROKEPATHNVPROC glIsPointInStrokePathNV; + PFNGLGETPATHLENGTHNVPROC glGetPathLengthNV; + PFNGLPOINTALONGPATHNVPROC glPointAlongPathNV; + PFNGLMATRIXLOAD3X2FNVPROC glMatrixLoad3x2fNV; + PFNGLMATRIXLOAD3X3FNVPROC glMatrixLoad3x3fNV; + PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC glMatrixLoadTranspose3x3fNV; + PFNGLMATRIXMULT3X2FNVPROC glMatrixMult3x2fNV; + PFNGLMATRIXMULT3X3FNVPROC glMatrixMult3x3fNV; + PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC glMatrixMultTranspose3x3fNV; + PFNGLSTENCILTHENCOVERFILLPATHNVPROC glStencilThenCoverFillPathNV; + PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC glStencilThenCoverStrokePathNV; + PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC glStencilThenCoverFillPathInstancedNV; + PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC glStencilThenCoverStrokePathInstancedNV; + PFNGLPATHGLYPHINDEXRANGENVPROC glPathGlyphIndexRangeNV; + PFNGLPATHGLYPHINDEXARRAYNVPROC glPathGlyphIndexArrayNV; + PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC glPathMemoryGlyphIndexArrayNV; + PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC glProgramPathFragmentInputGenNV; + PFNGLGETPROGRAMRESOURCEFVNVPROC glGetProgramResourcefvNV; + PFNGLPATHCOLORGENNVPROC glPathColorGenNV; + PFNGLPATHTEXGENNVPROC glPathTexGenNV; + PFNGLPATHFOGGENNVPROC glPathFogGenNV; + PFNGLGETPATHCOLORGENIVNVPROC glGetPathColorGenivNV; + PFNGLGETPATHCOLORGENFVNVPROC glGetPathColorGenfvNV; + PFNGLGETPATHTEXGENIVNVPROC glGetPathTexGenivNV; + PFNGLGETPATHTEXGENFVNVPROC glGetPathTexGenfvNV; + #endif + + // Group GL_NV_pixel_data_range + #if GL_NV_pixel_data_range == 1 + PFNGLPIXELDATARANGENVPROC glPixelDataRangeNV; + PFNGLFLUSHPIXELDATARANGENVPROC glFlushPixelDataRangeNV; + #endif + + // Group GL_NV_point_sprite + #if GL_NV_point_sprite == 1 + PFNGLPOINTPARAMETERINVPROC glPointParameteriNV; + PFNGLPOINTPARAMETERIVNVPROC glPointParameterivNV; + #endif + + // Group GL_NV_present_video + #if GL_NV_present_video == 1 + PFNGLPRESENTFRAMEKEYEDNVPROC glPresentFrameKeyedNV; + PFNGLPRESENTFRAMEDUALFILLNVPROC glPresentFrameDualFillNV; + PFNGLGETVIDEOIVNVPROC glGetVideoivNV; + PFNGLGETVIDEOUIVNVPROC glGetVideouivNV; + PFNGLGETVIDEOI64VNVPROC glGetVideoi64vNV; + PFNGLGETVIDEOUI64VNVPROC glGetVideoui64vNV; + #endif + + // Group GL_NV_primitive_restart + #if GL_NV_primitive_restart == 1 + PFNGLPRIMITIVERESTARTNVPROC glPrimitiveRestartNV; + PFNGLPRIMITIVERESTARTINDEXNVPROC glPrimitiveRestartIndexNV; + #endif + + // Group GL_NV_register_combiners + #if GL_NV_register_combiners == 1 + PFNGLCOMBINERPARAMETERFVNVPROC glCombinerParameterfvNV; + PFNGLCOMBINERPARAMETERFNVPROC glCombinerParameterfNV; + PFNGLCOMBINERPARAMETERIVNVPROC glCombinerParameterivNV; + PFNGLCOMBINERPARAMETERINVPROC glCombinerParameteriNV; + PFNGLCOMBINERINPUTNVPROC glCombinerInputNV; + PFNGLCOMBINEROUTPUTNVPROC glCombinerOutputNV; + PFNGLFINALCOMBINERINPUTNVPROC glFinalCombinerInputNV; + PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC glGetCombinerInputParameterfvNV; + PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC glGetCombinerInputParameterivNV; + PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC glGetCombinerOutputParameterfvNV; + PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC glGetCombinerOutputParameterivNV; + PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC glGetFinalCombinerInputParameterfvNV; + PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC glGetFinalCombinerInputParameterivNV; + #endif + + // Group GL_NV_register_combiners2 + #if GL_NV_register_combiners2 == 1 + PFNGLCOMBINERSTAGEPARAMETERFVNVPROC glCombinerStageParameterfvNV; + PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC glGetCombinerStageParameterfvNV; + #endif + + // Group GL_NV_sample_locations + #if GL_NV_sample_locations == 1 + PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC glFramebufferSampleLocationsfvNV; + PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC glNamedFramebufferSampleLocationsfvNV; + PFNGLRESOLVEDEPTHVALUESNVPROC glResolveDepthValuesNV; + #endif + + // Group GL_NV_shader_buffer_load + #if GL_NV_shader_buffer_load == 1 + PFNGLMAKEBUFFERRESIDENTNVPROC glMakeBufferResidentNV; + PFNGLMAKEBUFFERNONRESIDENTNVPROC glMakeBufferNonResidentNV; + PFNGLISBUFFERRESIDENTNVPROC glIsBufferResidentNV; + PFNGLMAKENAMEDBUFFERRESIDENTNVPROC glMakeNamedBufferResidentNV; + PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC glMakeNamedBufferNonResidentNV; + PFNGLISNAMEDBUFFERRESIDENTNVPROC glIsNamedBufferResidentNV; + PFNGLGETBUFFERPARAMETERUI64VNVPROC glGetBufferParameterui64vNV; + PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC glGetNamedBufferParameterui64vNV; + PFNGLGETINTEGERUI64VNVPROC glGetIntegerui64vNV; + PFNGLUNIFORMUI64NVPROC glUniformui64NV; + PFNGLUNIFORMUI64VNVPROC glUniformui64vNV; + PFNGLPROGRAMUNIFORMUI64NVPROC glProgramUniformui64NV; + PFNGLPROGRAMUNIFORMUI64VNVPROC glProgramUniformui64vNV; + #endif + + // Group GL_NV_texture_barrier + #if GL_NV_texture_barrier == 1 + PFNGLTEXTUREBARRIERNVPROC glTextureBarrierNV; + #endif + + // Group GL_NV_texture_multisample + #if GL_NV_texture_multisample == 1 + PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC glTexImage2DMultisampleCoverageNV; + PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC glTexImage3DMultisampleCoverageNV; + PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC glTextureImage2DMultisampleNV; + PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC glTextureImage3DMultisampleNV; + PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC glTextureImage2DMultisampleCoverageNV; + PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC glTextureImage3DMultisampleCoverageNV; + #endif + + // Group GL_NV_transform_feedback + #if GL_NV_transform_feedback == 1 + PFNGLBEGINTRANSFORMFEEDBACKNVPROC glBeginTransformFeedbackNV; + PFNGLENDTRANSFORMFEEDBACKNVPROC glEndTransformFeedbackNV; + PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC glTransformFeedbackAttribsNV; + PFNGLBINDBUFFERRANGENVPROC glBindBufferRangeNV; + PFNGLBINDBUFFEROFFSETNVPROC glBindBufferOffsetNV; + PFNGLBINDBUFFERBASENVPROC glBindBufferBaseNV; + PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC glTransformFeedbackVaryingsNV; + PFNGLACTIVEVARYINGNVPROC glActiveVaryingNV; + PFNGLGETVARYINGLOCATIONNVPROC glGetVaryingLocationNV; + PFNGLGETACTIVEVARYINGNVPROC glGetActiveVaryingNV; + PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC glGetTransformFeedbackVaryingNV; + PFNGLTRANSFORMFEEDBACKSTREAMATTRIBSNVPROC glTransformFeedbackStreamAttribsNV; + #endif + + // Group GL_NV_transform_feedback2 + #if GL_NV_transform_feedback2 == 1 + PFNGLBINDTRANSFORMFEEDBACKNVPROC glBindTransformFeedbackNV; + PFNGLDELETETRANSFORMFEEDBACKSNVPROC glDeleteTransformFeedbacksNV; + PFNGLGENTRANSFORMFEEDBACKSNVPROC glGenTransformFeedbacksNV; + PFNGLISTRANSFORMFEEDBACKNVPROC glIsTransformFeedbackNV; + PFNGLPAUSETRANSFORMFEEDBACKNVPROC glPauseTransformFeedbackNV; + PFNGLRESUMETRANSFORMFEEDBACKNVPROC glResumeTransformFeedbackNV; + PFNGLDRAWTRANSFORMFEEDBACKNVPROC glDrawTransformFeedbackNV; + #endif + + // Group GL_NV_vdpau_interop + #if GL_NV_vdpau_interop == 1 + PFNGLVDPAUINITNVPROC glVDPAUInitNV; + PFNGLVDPAUFININVPROC glVDPAUFiniNV; + PFNGLVDPAUREGISTERVIDEOSURFACENVPROC glVDPAURegisterVideoSurfaceNV; + PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC glVDPAURegisterOutputSurfaceNV; + PFNGLVDPAUISSURFACENVPROC glVDPAUIsSurfaceNV; + PFNGLVDPAUUNREGISTERSURFACENVPROC glVDPAUUnregisterSurfaceNV; + PFNGLVDPAUGETSURFACEIVNVPROC glVDPAUGetSurfaceivNV; + PFNGLVDPAUSURFACEACCESSNVPROC glVDPAUSurfaceAccessNV; + PFNGLVDPAUMAPSURFACESNVPROC glVDPAUMapSurfacesNV; + PFNGLVDPAUUNMAPSURFACESNVPROC glVDPAUUnmapSurfacesNV; + #endif + + // Group GL_NV_vertex_array_range + #if GL_NV_vertex_array_range == 1 + PFNGLFLUSHVERTEXARRAYRANGENVPROC glFlushVertexArrayRangeNV; + PFNGLVERTEXARRAYRANGENVPROC glVertexArrayRangeNV; + #endif + + // Group GL_NV_vertex_attrib_integer_64bit + #if GL_NV_vertex_attrib_integer_64bit == 1 + PFNGLVERTEXATTRIBL1I64NVPROC glVertexAttribL1i64NV; + PFNGLVERTEXATTRIBL2I64NVPROC glVertexAttribL2i64NV; + PFNGLVERTEXATTRIBL3I64NVPROC glVertexAttribL3i64NV; + PFNGLVERTEXATTRIBL4I64NVPROC glVertexAttribL4i64NV; + PFNGLVERTEXATTRIBL1I64VNVPROC glVertexAttribL1i64vNV; + PFNGLVERTEXATTRIBL2I64VNVPROC glVertexAttribL2i64vNV; + PFNGLVERTEXATTRIBL3I64VNVPROC glVertexAttribL3i64vNV; + PFNGLVERTEXATTRIBL4I64VNVPROC glVertexAttribL4i64vNV; + PFNGLVERTEXATTRIBL1UI64NVPROC glVertexAttribL1ui64NV; + PFNGLVERTEXATTRIBL2UI64NVPROC glVertexAttribL2ui64NV; + PFNGLVERTEXATTRIBL3UI64NVPROC glVertexAttribL3ui64NV; + PFNGLVERTEXATTRIBL4UI64NVPROC glVertexAttribL4ui64NV; + PFNGLVERTEXATTRIBL1UI64VNVPROC glVertexAttribL1ui64vNV; + PFNGLVERTEXATTRIBL2UI64VNVPROC glVertexAttribL2ui64vNV; + PFNGLVERTEXATTRIBL3UI64VNVPROC glVertexAttribL3ui64vNV; + PFNGLVERTEXATTRIBL4UI64VNVPROC glVertexAttribL4ui64vNV; + PFNGLGETVERTEXATTRIBLI64VNVPROC glGetVertexAttribLi64vNV; + PFNGLGETVERTEXATTRIBLUI64VNVPROC glGetVertexAttribLui64vNV; + PFNGLVERTEXATTRIBLFORMATNVPROC glVertexAttribLFormatNV; + #endif + + // Group GL_NV_vertex_buffer_unified_memory + #if GL_NV_vertex_buffer_unified_memory == 1 + PFNGLBUFFERADDRESSRANGENVPROC glBufferAddressRangeNV; + PFNGLVERTEXFORMATNVPROC glVertexFormatNV; + PFNGLNORMALFORMATNVPROC glNormalFormatNV; + PFNGLCOLORFORMATNVPROC glColorFormatNV; + PFNGLINDEXFORMATNVPROC glIndexFormatNV; + PFNGLTEXCOORDFORMATNVPROC glTexCoordFormatNV; + PFNGLEDGEFLAGFORMATNVPROC glEdgeFlagFormatNV; + PFNGLSECONDARYCOLORFORMATNVPROC glSecondaryColorFormatNV; + PFNGLFOGCOORDFORMATNVPROC glFogCoordFormatNV; + PFNGLVERTEXATTRIBFORMATNVPROC glVertexAttribFormatNV; + PFNGLVERTEXATTRIBIFORMATNVPROC glVertexAttribIFormatNV; + PFNGLGETINTEGERUI64I_VNVPROC glGetIntegerui64i_vNV; + #endif + + // Group GL_NV_vertex_program + #if GL_NV_vertex_program == 1 + PFNGLAREPROGRAMSRESIDENTNVPROC glAreProgramsResidentNV; + PFNGLBINDPROGRAMNVPROC glBindProgramNV; + PFNGLDELETEPROGRAMSNVPROC glDeleteProgramsNV; + PFNGLEXECUTEPROGRAMNVPROC glExecuteProgramNV; + PFNGLGENPROGRAMSNVPROC glGenProgramsNV; + PFNGLGETPROGRAMPARAMETERDVNVPROC glGetProgramParameterdvNV; + PFNGLGETPROGRAMPARAMETERFVNVPROC glGetProgramParameterfvNV; + PFNGLGETPROGRAMIVNVPROC glGetProgramivNV; + PFNGLGETPROGRAMSTRINGNVPROC glGetProgramStringNV; + PFNGLGETTRACKMATRIXIVNVPROC glGetTrackMatrixivNV; + PFNGLGETVERTEXATTRIBDVNVPROC glGetVertexAttribdvNV; + PFNGLGETVERTEXATTRIBFVNVPROC glGetVertexAttribfvNV; + PFNGLGETVERTEXATTRIBIVNVPROC glGetVertexAttribivNV; + PFNGLGETVERTEXATTRIBPOINTERVNVPROC glGetVertexAttribPointervNV; + PFNGLISPROGRAMNVPROC glIsProgramNV; + PFNGLLOADPROGRAMNVPROC glLoadProgramNV; + PFNGLPROGRAMPARAMETER4DNVPROC glProgramParameter4dNV; + PFNGLPROGRAMPARAMETER4DVNVPROC glProgramParameter4dvNV; + PFNGLPROGRAMPARAMETER4FNVPROC glProgramParameter4fNV; + PFNGLPROGRAMPARAMETER4FVNVPROC glProgramParameter4fvNV; + PFNGLPROGRAMPARAMETERS4DVNVPROC glProgramParameters4dvNV; + PFNGLPROGRAMPARAMETERS4FVNVPROC glProgramParameters4fvNV; + PFNGLREQUESTRESIDENTPROGRAMSNVPROC glRequestResidentProgramsNV; + PFNGLTRACKMATRIXNVPROC glTrackMatrixNV; + PFNGLVERTEXATTRIBPOINTERNVPROC glVertexAttribPointerNV; + PFNGLVERTEXATTRIB1DNVPROC glVertexAttrib1dNV; + PFNGLVERTEXATTRIB1DVNVPROC glVertexAttrib1dvNV; + PFNGLVERTEXATTRIB1FNVPROC glVertexAttrib1fNV; + PFNGLVERTEXATTRIB1FVNVPROC glVertexAttrib1fvNV; + PFNGLVERTEXATTRIB1SNVPROC glVertexAttrib1sNV; + PFNGLVERTEXATTRIB1SVNVPROC glVertexAttrib1svNV; + PFNGLVERTEXATTRIB2DNVPROC glVertexAttrib2dNV; + PFNGLVERTEXATTRIB2DVNVPROC glVertexAttrib2dvNV; + PFNGLVERTEXATTRIB2FNVPROC glVertexAttrib2fNV; + PFNGLVERTEXATTRIB2FVNVPROC glVertexAttrib2fvNV; + PFNGLVERTEXATTRIB2SNVPROC glVertexAttrib2sNV; + PFNGLVERTEXATTRIB2SVNVPROC glVertexAttrib2svNV; + PFNGLVERTEXATTRIB3DNVPROC glVertexAttrib3dNV; + PFNGLVERTEXATTRIB3DVNVPROC glVertexAttrib3dvNV; + PFNGLVERTEXATTRIB3FNVPROC glVertexAttrib3fNV; + PFNGLVERTEXATTRIB3FVNVPROC glVertexAttrib3fvNV; + PFNGLVERTEXATTRIB3SNVPROC glVertexAttrib3sNV; + PFNGLVERTEXATTRIB3SVNVPROC glVertexAttrib3svNV; + PFNGLVERTEXATTRIB4DNVPROC glVertexAttrib4dNV; + PFNGLVERTEXATTRIB4DVNVPROC glVertexAttrib4dvNV; + PFNGLVERTEXATTRIB4FNVPROC glVertexAttrib4fNV; + PFNGLVERTEXATTRIB4FVNVPROC glVertexAttrib4fvNV; + PFNGLVERTEXATTRIB4SNVPROC glVertexAttrib4sNV; + PFNGLVERTEXATTRIB4SVNVPROC glVertexAttrib4svNV; + PFNGLVERTEXATTRIB4UBNVPROC glVertexAttrib4ubNV; + PFNGLVERTEXATTRIB4UBVNVPROC glVertexAttrib4ubvNV; + PFNGLVERTEXATTRIBS1DVNVPROC glVertexAttribs1dvNV; + PFNGLVERTEXATTRIBS1FVNVPROC glVertexAttribs1fvNV; + PFNGLVERTEXATTRIBS1SVNVPROC glVertexAttribs1svNV; + PFNGLVERTEXATTRIBS2DVNVPROC glVertexAttribs2dvNV; + PFNGLVERTEXATTRIBS2FVNVPROC glVertexAttribs2fvNV; + PFNGLVERTEXATTRIBS2SVNVPROC glVertexAttribs2svNV; + PFNGLVERTEXATTRIBS3DVNVPROC glVertexAttribs3dvNV; + PFNGLVERTEXATTRIBS3FVNVPROC glVertexAttribs3fvNV; + PFNGLVERTEXATTRIBS3SVNVPROC glVertexAttribs3svNV; + PFNGLVERTEXATTRIBS4DVNVPROC glVertexAttribs4dvNV; + PFNGLVERTEXATTRIBS4FVNVPROC glVertexAttribs4fvNV; + PFNGLVERTEXATTRIBS4SVNVPROC glVertexAttribs4svNV; + PFNGLVERTEXATTRIBS4UBVNVPROC glVertexAttribs4ubvNV; + #endif + + // Group GL_NV_vertex_program4 + #if GL_NV_vertex_program4 == 1 + PFNGLVERTEXATTRIBI1IEXTPROC glVertexAttribI1iEXT; + PFNGLVERTEXATTRIBI2IEXTPROC glVertexAttribI2iEXT; + PFNGLVERTEXATTRIBI3IEXTPROC glVertexAttribI3iEXT; + PFNGLVERTEXATTRIBI4IEXTPROC glVertexAttribI4iEXT; + PFNGLVERTEXATTRIBI1UIEXTPROC glVertexAttribI1uiEXT; + PFNGLVERTEXATTRIBI2UIEXTPROC glVertexAttribI2uiEXT; + PFNGLVERTEXATTRIBI3UIEXTPROC glVertexAttribI3uiEXT; + PFNGLVERTEXATTRIBI4UIEXTPROC glVertexAttribI4uiEXT; + PFNGLVERTEXATTRIBI1IVEXTPROC glVertexAttribI1ivEXT; + PFNGLVERTEXATTRIBI2IVEXTPROC glVertexAttribI2ivEXT; + PFNGLVERTEXATTRIBI3IVEXTPROC glVertexAttribI3ivEXT; + PFNGLVERTEXATTRIBI4IVEXTPROC glVertexAttribI4ivEXT; + PFNGLVERTEXATTRIBI1UIVEXTPROC glVertexAttribI1uivEXT; + PFNGLVERTEXATTRIBI2UIVEXTPROC glVertexAttribI2uivEXT; + PFNGLVERTEXATTRIBI3UIVEXTPROC glVertexAttribI3uivEXT; + PFNGLVERTEXATTRIBI4UIVEXTPROC glVertexAttribI4uivEXT; + PFNGLVERTEXATTRIBI4BVEXTPROC glVertexAttribI4bvEXT; + PFNGLVERTEXATTRIBI4SVEXTPROC glVertexAttribI4svEXT; + PFNGLVERTEXATTRIBI4UBVEXTPROC glVertexAttribI4ubvEXT; + PFNGLVERTEXATTRIBI4USVEXTPROC glVertexAttribI4usvEXT; + PFNGLVERTEXATTRIBIPOINTEREXTPROC glVertexAttribIPointerEXT; + PFNGLGETVERTEXATTRIBIIVEXTPROC glGetVertexAttribIivEXT; + PFNGLGETVERTEXATTRIBIUIVEXTPROC glGetVertexAttribIuivEXT; + #endif + + // Group GL_NV_video_capture + #if GL_NV_video_capture == 1 + PFNGLBEGINVIDEOCAPTURENVPROC glBeginVideoCaptureNV; + PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC glBindVideoCaptureStreamBufferNV; + PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC glBindVideoCaptureStreamTextureNV; + PFNGLENDVIDEOCAPTURENVPROC glEndVideoCaptureNV; + PFNGLGETVIDEOCAPTUREIVNVPROC glGetVideoCaptureivNV; + PFNGLGETVIDEOCAPTURESTREAMIVNVPROC glGetVideoCaptureStreamivNV; + PFNGLGETVIDEOCAPTURESTREAMFVNVPROC glGetVideoCaptureStreamfvNV; + PFNGLGETVIDEOCAPTURESTREAMDVNVPROC glGetVideoCaptureStreamdvNV; + PFNGLVIDEOCAPTURENVPROC glVideoCaptureNV; + PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC glVideoCaptureStreamParameterivNV; + PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC glVideoCaptureStreamParameterfvNV; + PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC glVideoCaptureStreamParameterdvNV; + #endif + + // Group GL_OVR_multiview + #if GL_OVR_multiview == 1 + PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC glFramebufferTextureMultiviewOVR; + #endif + + // Group GL_PGI_misc_hints + #if GL_PGI_misc_hints == 1 + PFNGLHINTPGIPROC glHintPGI; + #endif + + // Group GL_SGIS_detail_texture + #if GL_SGIS_detail_texture == 1 + PFNGLDETAILTEXFUNCSGISPROC glDetailTexFuncSGIS; + PFNGLGETDETAILTEXFUNCSGISPROC glGetDetailTexFuncSGIS; + #endif + + // Group GL_SGIS_fog_function + #if GL_SGIS_fog_function == 1 + PFNGLFOGFUNCSGISPROC glFogFuncSGIS; + PFNGLGETFOGFUNCSGISPROC glGetFogFuncSGIS; + #endif + + // Group GL_SGIS_multisample + #if GL_SGIS_multisample == 1 + PFNGLSAMPLEMASKSGISPROC glSampleMaskSGIS; + PFNGLSAMPLEPATTERNSGISPROC glSamplePatternSGIS; + #endif + + // Group GL_SGIS_pixel_texture + #if GL_SGIS_pixel_texture == 1 + PFNGLPIXELTEXGENPARAMETERISGISPROC glPixelTexGenParameteriSGIS; + PFNGLPIXELTEXGENPARAMETERIVSGISPROC glPixelTexGenParameterivSGIS; + PFNGLPIXELTEXGENPARAMETERFSGISPROC glPixelTexGenParameterfSGIS; + PFNGLPIXELTEXGENPARAMETERFVSGISPROC glPixelTexGenParameterfvSGIS; + PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC glGetPixelTexGenParameterivSGIS; + PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC glGetPixelTexGenParameterfvSGIS; + #endif + + // Group GL_SGIS_point_parameters + #if GL_SGIS_point_parameters == 1 + PFNGLPOINTPARAMETERFSGISPROC glPointParameterfSGIS; + PFNGLPOINTPARAMETERFVSGISPROC glPointParameterfvSGIS; + #endif + + // Group GL_SGIS_sharpen_texture + #if GL_SGIS_sharpen_texture == 1 + PFNGLSHARPENTEXFUNCSGISPROC glSharpenTexFuncSGIS; + PFNGLGETSHARPENTEXFUNCSGISPROC glGetSharpenTexFuncSGIS; + #endif + + // Group GL_SGIS_texture4D + #if GL_SGIS_texture4D == 1 + PFNGLTEXIMAGE4DSGISPROC glTexImage4DSGIS; + PFNGLTEXSUBIMAGE4DSGISPROC glTexSubImage4DSGIS; + #endif + + // Group GL_SGIS_texture_color_mask + #if GL_SGIS_texture_color_mask == 1 + PFNGLTEXTURECOLORMASKSGISPROC glTextureColorMaskSGIS; + #endif + + // Group GL_SGIS_texture_filter4 + #if GL_SGIS_texture_filter4 == 1 + PFNGLGETTEXFILTERFUNCSGISPROC glGetTexFilterFuncSGIS; + PFNGLTEXFILTERFUNCSGISPROC glTexFilterFuncSGIS; + #endif + + // Group GL_SGIX_async + #if GL_SGIX_async == 1 + PFNGLASYNCMARKERSGIXPROC glAsyncMarkerSGIX; + PFNGLFINISHASYNCSGIXPROC glFinishAsyncSGIX; + PFNGLPOLLASYNCSGIXPROC glPollAsyncSGIX; + PFNGLGENASYNCMARKERSSGIXPROC glGenAsyncMarkersSGIX; + PFNGLDELETEASYNCMARKERSSGIXPROC glDeleteAsyncMarkersSGIX; + PFNGLISASYNCMARKERSGIXPROC glIsAsyncMarkerSGIX; + #endif + + // Group GL_SGIX_flush_raster + #if GL_SGIX_flush_raster == 1 + PFNGLFLUSHRASTERSGIXPROC glFlushRasterSGIX; + #endif + + // Group GL_SGIX_fragment_lighting + #if GL_SGIX_fragment_lighting == 1 + PFNGLFRAGMENTCOLORMATERIALSGIXPROC glFragmentColorMaterialSGIX; + PFNGLFRAGMENTLIGHTFSGIXPROC glFragmentLightfSGIX; + PFNGLFRAGMENTLIGHTFVSGIXPROC glFragmentLightfvSGIX; + PFNGLFRAGMENTLIGHTISGIXPROC glFragmentLightiSGIX; + PFNGLFRAGMENTLIGHTIVSGIXPROC glFragmentLightivSGIX; + PFNGLFRAGMENTLIGHTMODELFSGIXPROC glFragmentLightModelfSGIX; + PFNGLFRAGMENTLIGHTMODELFVSGIXPROC glFragmentLightModelfvSGIX; + PFNGLFRAGMENTLIGHTMODELISGIXPROC glFragmentLightModeliSGIX; + PFNGLFRAGMENTLIGHTMODELIVSGIXPROC glFragmentLightModelivSGIX; + PFNGLFRAGMENTMATERIALFSGIXPROC glFragmentMaterialfSGIX; + PFNGLFRAGMENTMATERIALFVSGIXPROC glFragmentMaterialfvSGIX; + PFNGLFRAGMENTMATERIALISGIXPROC glFragmentMaterialiSGIX; + PFNGLFRAGMENTMATERIALIVSGIXPROC glFragmentMaterialivSGIX; + PFNGLGETFRAGMENTLIGHTFVSGIXPROC glGetFragmentLightfvSGIX; + PFNGLGETFRAGMENTLIGHTIVSGIXPROC glGetFragmentLightivSGIX; + PFNGLGETFRAGMENTMATERIALFVSGIXPROC glGetFragmentMaterialfvSGIX; + PFNGLGETFRAGMENTMATERIALIVSGIXPROC glGetFragmentMaterialivSGIX; + PFNGLLIGHTENVISGIXPROC glLightEnviSGIX; + #endif + + // Group GL_SGIX_framezoom + #if GL_SGIX_framezoom == 1 + PFNGLFRAMEZOOMSGIXPROC glFrameZoomSGIX; + #endif + + // Group GL_SGIX_igloo_interface + #if GL_SGIX_igloo_interface == 1 + PFNGLIGLOOINTERFACESGIXPROC glIglooInterfaceSGIX; + #endif + + // Group GL_SGIX_instruments + #if GL_SGIX_instruments == 1 + PFNGLGETINSTRUMENTSSGIXPROC glGetInstrumentsSGIX; + PFNGLINSTRUMENTSBUFFERSGIXPROC glInstrumentsBufferSGIX; + PFNGLPOLLINSTRUMENTSSGIXPROC glPollInstrumentsSGIX; + PFNGLREADINSTRUMENTSSGIXPROC glReadInstrumentsSGIX; + PFNGLSTARTINSTRUMENTSSGIXPROC glStartInstrumentsSGIX; + PFNGLSTOPINSTRUMENTSSGIXPROC glStopInstrumentsSGIX; + #endif + + // Group GL_SGIX_list_priority + #if GL_SGIX_list_priority == 1 + PFNGLGETLISTPARAMETERFVSGIXPROC glGetListParameterfvSGIX; + PFNGLGETLISTPARAMETERIVSGIXPROC glGetListParameterivSGIX; + PFNGLLISTPARAMETERFSGIXPROC glListParameterfSGIX; + PFNGLLISTPARAMETERFVSGIXPROC glListParameterfvSGIX; + PFNGLLISTPARAMETERISGIXPROC glListParameteriSGIX; + PFNGLLISTPARAMETERIVSGIXPROC glListParameterivSGIX; + #endif + + // Group GL_SGIX_pixel_texture + #if GL_SGIX_pixel_texture == 1 + PFNGLPIXELTEXGENSGIXPROC glPixelTexGenSGIX; + #endif + + // Group GL_SGIX_polynomial_ffd + #if GL_SGIX_polynomial_ffd == 1 + PFNGLDEFORMATIONMAP3DSGIXPROC glDeformationMap3dSGIX; + PFNGLDEFORMATIONMAP3FSGIXPROC glDeformationMap3fSGIX; + PFNGLDEFORMSGIXPROC glDeformSGIX; + PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC glLoadIdentityDeformationMapSGIX; + #endif + + // Group GL_SGIX_reference_plane + #if GL_SGIX_reference_plane == 1 + PFNGLREFERENCEPLANESGIXPROC glReferencePlaneSGIX; + #endif + + // Group GL_SGIX_sprite + #if GL_SGIX_sprite == 1 + PFNGLSPRITEPARAMETERFSGIXPROC glSpriteParameterfSGIX; + PFNGLSPRITEPARAMETERFVSGIXPROC glSpriteParameterfvSGIX; + PFNGLSPRITEPARAMETERISGIXPROC glSpriteParameteriSGIX; + PFNGLSPRITEPARAMETERIVSGIXPROC glSpriteParameterivSGIX; + #endif + + // Group GL_SGIX_tag_sample_buffer + #if GL_SGIX_tag_sample_buffer == 1 + PFNGLTAGSAMPLEBUFFERSGIXPROC glTagSampleBufferSGIX; + #endif + + // Group GL_SGI_color_table + #if GL_SGI_color_table == 1 + PFNGLCOLORTABLESGIPROC glColorTableSGI; + PFNGLCOLORTABLEPARAMETERFVSGIPROC glColorTableParameterfvSGI; + PFNGLCOLORTABLEPARAMETERIVSGIPROC glColorTableParameterivSGI; + PFNGLCOPYCOLORTABLESGIPROC glCopyColorTableSGI; + PFNGLGETCOLORTABLESGIPROC glGetColorTableSGI; + PFNGLGETCOLORTABLEPARAMETERFVSGIPROC glGetColorTableParameterfvSGI; + PFNGLGETCOLORTABLEPARAMETERIVSGIPROC glGetColorTableParameterivSGI; + #endif + + // Group GL_SUNX_constant_data + #if GL_SUNX_constant_data == 1 + PFNGLFINISHTEXTURESUNXPROC glFinishTextureSUNX; + #endif + + // Group GL_SUN_global_alpha + #if GL_SUN_global_alpha == 1 + PFNGLGLOBALALPHAFACTORBSUNPROC glGlobalAlphaFactorbSUN; + PFNGLGLOBALALPHAFACTORSSUNPROC glGlobalAlphaFactorsSUN; + PFNGLGLOBALALPHAFACTORISUNPROC glGlobalAlphaFactoriSUN; + PFNGLGLOBALALPHAFACTORFSUNPROC glGlobalAlphaFactorfSUN; + PFNGLGLOBALALPHAFACTORDSUNPROC glGlobalAlphaFactordSUN; + PFNGLGLOBALALPHAFACTORUBSUNPROC glGlobalAlphaFactorubSUN; + PFNGLGLOBALALPHAFACTORUSSUNPROC glGlobalAlphaFactorusSUN; + PFNGLGLOBALALPHAFACTORUISUNPROC glGlobalAlphaFactoruiSUN; + #endif + + // Group GL_SUN_mesh_array + #if GL_SUN_mesh_array == 1 + PFNGLDRAWMESHARRAYSSUNPROC glDrawMeshArraysSUN; + #endif + + // Group GL_SUN_triangle_list + #if GL_SUN_triangle_list == 1 + PFNGLREPLACEMENTCODEUISUNPROC glReplacementCodeuiSUN; + PFNGLREPLACEMENTCODEUSSUNPROC glReplacementCodeusSUN; + PFNGLREPLACEMENTCODEUBSUNPROC glReplacementCodeubSUN; + PFNGLREPLACEMENTCODEUIVSUNPROC glReplacementCodeuivSUN; + PFNGLREPLACEMENTCODEUSVSUNPROC glReplacementCodeusvSUN; + PFNGLREPLACEMENTCODEUBVSUNPROC glReplacementCodeubvSUN; + PFNGLREPLACEMENTCODEPOINTERSUNPROC glReplacementCodePointerSUN; + #endif + + // Group GL_SUN_vertex + #if GL_SUN_vertex == 1 + PFNGLCOLOR4UBVERTEX2FSUNPROC glColor4ubVertex2fSUN; + PFNGLCOLOR4UBVERTEX2FVSUNPROC glColor4ubVertex2fvSUN; + PFNGLCOLOR4UBVERTEX3FSUNPROC glColor4ubVertex3fSUN; + PFNGLCOLOR4UBVERTEX3FVSUNPROC glColor4ubVertex3fvSUN; + PFNGLCOLOR3FVERTEX3FSUNPROC glColor3fVertex3fSUN; + PFNGLCOLOR3FVERTEX3FVSUNPROC glColor3fVertex3fvSUN; + PFNGLNORMAL3FVERTEX3FSUNPROC glNormal3fVertex3fSUN; + PFNGLNORMAL3FVERTEX3FVSUNPROC glNormal3fVertex3fvSUN; + PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC glColor4fNormal3fVertex3fSUN; + PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC glColor4fNormal3fVertex3fvSUN; + PFNGLTEXCOORD2FVERTEX3FSUNPROC glTexCoord2fVertex3fSUN; + PFNGLTEXCOORD2FVERTEX3FVSUNPROC glTexCoord2fVertex3fvSUN; + PFNGLTEXCOORD4FVERTEX4FSUNPROC glTexCoord4fVertex4fSUN; + PFNGLTEXCOORD4FVERTEX4FVSUNPROC glTexCoord4fVertex4fvSUN; + PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC glTexCoord2fColor4ubVertex3fSUN; + PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC glTexCoord2fColor4ubVertex3fvSUN; + PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC glTexCoord2fColor3fVertex3fSUN; + PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC glTexCoord2fColor3fVertex3fvSUN; + PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC glTexCoord2fNormal3fVertex3fSUN; + PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC glTexCoord2fNormal3fVertex3fvSUN; + PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC glTexCoord2fColor4fNormal3fVertex3fSUN; + PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC glTexCoord2fColor4fNormal3fVertex3fvSUN; + PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC glTexCoord4fColor4fNormal3fVertex4fSUN; + PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC glTexCoord4fColor4fNormal3fVertex4fvSUN; + PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC glReplacementCodeuiVertex3fSUN; + PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC glReplacementCodeuiVertex3fvSUN; + PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC glReplacementCodeuiColor4ubVertex3fSUN; + PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC glReplacementCodeuiColor4ubVertex3fvSUN; + PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC glReplacementCodeuiColor3fVertex3fSUN; + PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC glReplacementCodeuiColor3fVertex3fvSUN; + PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC glReplacementCodeuiNormal3fVertex3fSUN; + PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC glReplacementCodeuiNormal3fVertex3fvSUN; + PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC glReplacementCodeuiColor4fNormal3fVertex3fSUN; + PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC glReplacementCodeuiColor4fNormal3fVertex3fvSUN; + PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC glReplacementCodeuiTexCoord2fVertex3fSUN; + PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC glReplacementCodeuiTexCoord2fVertex3fvSUN; + PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN; + PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN; + PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN; + PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN; + #endif + }; +}; +#endif diff --git a/third-party-libs/FragmentFramework/include/gl/monitors.h b/dependencies/FragmentFramework/include/gl/monitors.hpp similarity index 86% rename from third-party-libs/FragmentFramework/include/gl/monitors.h rename to dependencies/FragmentFramework/include/gl/monitors.hpp index 627e497..5dc8657 100644 --- a/third-party-libs/FragmentFramework/include/gl/monitors.h +++ b/dependencies/FragmentFramework/include/gl/monitors.hpp @@ -4,13 +4,11 @@ * Licensed under the MIT License */ -#ifndef FFW_GL_EXTENSIONS -#define FFW_GL_EXTENSIONS - -#include +#ifndef FFW_GL_MONITORS +#define FFW_GL_MONITORS +#include "../config.h" #include "../math/math.h" - #include #include @@ -53,7 +51,7 @@ namespace ffw{ @ingroup Core */ vec2i physicalSize; - GLFWmonitor* ptr; + void* ptr; }; /*! @memberof ffw @@ -80,17 +78,17 @@ namespace ffw{ @memberof ffw @ingroup Core */ - std::vector getMonitors(); + std::vector FFW_API getMonitors(); /*! @memberof ffw @ingroup Core */ - monitor getPrimaryMonitor(); + monitor FFW_API getPrimaryMonitor(); /*! @memberof ffw @ingroup Core */ - std::vector getMonitorModes(monitor Monitor); + std::vector FFW_API getMonitorModes(monitor Monitor); }; #endif diff --git a/dependencies/FragmentFramework/include/graphics/basicDraw.hpp b/dependencies/FragmentFramework/include/graphics/basicDraw.hpp new file mode 100644 index 0000000..85195c4 --- /dev/null +++ b/dependencies/FragmentFramework/include/graphics/basicDraw.hpp @@ -0,0 +1,115 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_BASIC_DRAW +#define FFW_BASIC_DRAW + +#include "../config.h" +#include "../render/renderContext.hpp" +#include "texture2D.hpp" +#include "font.hpp" + +/*! + @ingroup Graphics +*/ +namespace ffw{ + /*! + @memberof ffw + @ingroup Graphics + */ + void FFW_API drawRectangle(const ffw::renderContext* Context, int PosX, int PosY, int Width, int Height); + /*! + @memberof ffw + @ingroup Graphics + */ + void FFW_API drawTriangle(const ffw::renderContext* Context, int P0x, int P0y, int P1x, int P1y, int P2x, int P2y); + /*! + @memberof ffw + @ingroup Graphics + */ + void FFW_API drawTexture(const ffw::renderContext* Context, int PosX, int PosY, int Width, int Height, const ffw::texture2D* Texture); + /*! + @memberof ffw + @ingroup Graphics + */ + void FFW_API drawTexture(const ffw::renderContext* Context, int PosX, int PosY, int Width, int Height, const ffw::texture2D* Texture, bool MirrorX, bool MirrorY); + /*! + @memberof ffw + @ingroup Graphics + */ + void FFW_API drawTextureSubsection(const ffw::renderContext* Context, int PosX, int PosY, int Width, int Height, const ffw::texture2D* Texture, float SubX, float SubY, float SubW, float SubH); + /*! + @memberof ffw + @ingroup Graphics + */ + void FFW_API drawTextureSubsection(const ffw::renderContext* Context, int PosX, int PosY, int Width, int Height, const ffw::texture2D* Texture, float SubX, float SubY, float SubW, float SubH, bool MirrorX, bool MirrorY); + /*! + @memberof ffw + @ingroup Graphics + */ + void FFW_API drawArc(const ffw::renderContext* Context, int PosX, int PosY, int InnerRadius, int OuterRadius, int StartAngle, int EndAngle, int Steps); + /*! + @memberof ffw + @ingroup Graphics + */ + void FFW_API drawCircle(const ffw::renderContext* Context, int PosX, int PosY, int Radius, int Steps); + /*! + @memberof ffw + @ingroup Graphics + */ + void FFW_API drawLine(const ffw::renderContext* Context, int StartX, int StartY, int EndX, int EndY); + /*! + @memberof ffw + @ingroup Graphics + */ + void FFW_API drawLineThick(const ffw::renderContext* Context, int StartX, int StartY, int EndX, int EndY, int Thickness); + /*! + @memberof ffw + @ingroup Graphics + */ + void FFW_API drawString(const ffw::renderContext* Context, int PosX, int PosY, const font* Font, const std::string& Str); + /*! + @memberof ffw + @ingroup Graphics + */ + void FFW_API drawString(const ffw::renderContext* Context, int PosX, int PosY, const font* Font, const std::wstring& Str); + /*! + @memberof ffw + @ingroup Graphics + */ + void FFW_API drawBezier(const ffw::renderContext* Context, int StartX, int StartY, int CP0X, int CP0Y, int CP1X, int CP1Y, int EndX, int EndY, int Steps); + /*! + @memberof ffw + @ingroup Graphics + */ + void FFW_API drawBezierThick(const ffw::renderContext* Context, int StartX, int StartY, int CP0X, int CP0Y, int CP1X, int CP1Y, int EndX, int EndY, int Thickness, int Steps); + /*! + @memberof ffw + @ingroup Graphics + */ + void FFW_API enableBlendFunc(const ffw::renderContext* Context, unsigned int source, unsigned int destination); + /*! + @memberof ffw + @ingroup Graphics + */ + void FFW_API enableBlendFuncSeparate(const ffw::renderContext* Context, unsigned int srcRgb, unsigned int destRgb, unsigned int srcAlpha, unsigned int destAlpha); + /*! + @memberof ffw + @ingroup Graphics + */ + void FFW_API disableBlendFunc(const ffw::renderContext* Context); + /*! + @memberof ffw + @ingroup Graphics + */ + void FFW_API activeTexture(const ffw::renderContext* Context, unsigned int Texture); + /*! + @memberof ffw + @ingroup Graphics + */ + void FFW_API setDrawBuffers(const ffw::renderContext* Context, int Num, const unsigned int* Buffs); +}; +#endif diff --git a/dependencies/FragmentFramework/include/graphics/basicShaders.hpp b/dependencies/FragmentFramework/include/graphics/basicShaders.hpp new file mode 100644 index 0000000..e440b24 --- /dev/null +++ b/dependencies/FragmentFramework/include/graphics/basicShaders.hpp @@ -0,0 +1,65 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_BASIC_SHADERS +#define FFW_BASIC_SHADERS + +#include "../config.h" +#include "shader.hpp" + +namespace ffw{ + class renderContext; + + class FFW_API basicShaders { + public: + basicShaders(); + ~basicShaders(); + + bool init(renderContext* Context); + void deleteShaders(); + + shader genericShader; + shader arcShader; + shader fontShader; + shader bezierShader; + shader bezierAdvShader; + + int arcShaderMvpLoc; + int arcShaderPosLoc; + int arcShaderSizeLoc; + int arcShaderColorLoc; + int arcShaderAngleLoc; + int arcShaderStepsLoc; + + int genShaderMvpLoc; + int genShaderPosLoc; + int genShaderColorLoc; + int genShaderSamplerLoc; + int genShaderUvsLoc; + int genShaderBranchLoc; + + int fontShaderMvpLoc; + int fontShaderSamplerLoc; + int fontShaderColorLoc; + int fontShaderPosLoc; + int fontShaderUvsLoc; + int fontShaderOffsetLoc; + int fontShaderScaleLoc; + + int bezierShaderMvpLoc; + int bezierShaderPointsLoc; + int bezierShaderColorLoc; + int bezierShaderStepsLoc; + + int bezierAdvShaderMvpLoc; + int bezierAdvShaderPointsLoc; + int bezierAdvShaderColorLoc; + int bezierAdvShaderStepsLoc; + int bezierAdvShaderThickLoc; + }; +}; + +#endif diff --git a/third-party-libs/FragmentFramework/include/graphics/bufferObject.h b/dependencies/FragmentFramework/include/graphics/bufferObject.hpp similarity index 58% rename from third-party-libs/FragmentFramework/include/graphics/bufferObject.h rename to dependencies/FragmentFramework/include/graphics/bufferObject.hpp index 0c6dbb5..9149f1b 100644 --- a/third-party-libs/FragmentFramework/include/graphics/bufferObject.h +++ b/dependencies/FragmentFramework/include/graphics/bufferObject.hpp @@ -7,14 +7,14 @@ #ifndef FFW_BUFFER_OBJECT #define FFW_BUFFER_OBJECT -#include "../dll.h" -#include -#include +#include "../config.h" +#include "../gl/extensions.hpp" /*! @ingroup Graphics */ namespace ffw { + class renderContext; /*! @memberof ffw @ingroup Graphics @@ -28,110 +28,95 @@ namespace ffw { @ingroup Graphics */ - bool init(GLenum ObjectType); + bool init(const renderContext* Context, unsigned int ObjectType); /*! @memberof bufferObject @ingroup Graphics */ - bool isLoaded() const; + bool isCreated() const; /*! @memberof bufferObject @ingroup Graphics */ - bool createBuffer(const void* Data, GLsizei Size, GLenum Type); + bool createBuffer(const void* Data, int Size, unsigned int Type); /*! @memberof bufferObject @ingroup Graphics */ - bool uploadData(const void* Data, GLsizei Offset, GLsizei Size); + bool uploadData(const void* Data, int Offset, int Size); /*! @memberof bufferObject @ingroup Graphics */ - bool mapBuffer(void** Pointer, GLenum Access); + bool mapBuffer(void** Pointer, unsigned int Access) const; /*! @memberof bufferObject @ingroup Graphics */ - bool unmapBuffer(); + bool unmapBuffer() const; /*! @memberof bufferObject @ingroup Graphics */ - bool deleteBuffer(); + bool destroy(); /*! @memberof bufferObject @ingroup Graphics */ - bool bind(); + bool bind() const; /*! @memberof bufferObject @ingroup Graphics */ - void unbind(); + void unbind() const; /*! @memberof bufferObject @ingroup Graphics */ - GLuint getBuffer() const; + unsigned int getBuffer() const; /*! @memberof bufferObject @ingroup Graphics */ - GLsizei getSize() const; + int getSize() const; /*! @memberof bufferObject @ingroup Graphics */ - GLenum getType() const; + unsigned int getType() const; /*! @memberof bufferObject @ingroup Graphics */ - GLenum getObjectType() const; + unsigned int getObjectType() const; /*! @memberof bufferObject @ingroup Graphics */ - bool copyFrom(bufferObject* Other, GLintptr Offset1, GLintptr Offset2, GLsizeiptr Size); - /*! - @memberof bufferObject - @ingroup Graphics - - */ - bufferObject& operator = (const bufferObject& Other); + bool copyFrom(const bufferObject* Other, ptrdiff_t Offset1, ptrdiff_t Offset2, ptrdiff_t Size); private: - GLenum type; - GLenum objectType; + unsigned int type; + unsigned int objectType; bool loaded; - // VBO pointer - GLuint buffer; - // Size of buffer - GLsizei size; + unsigned int buffer; + int size; bool initialized; - PFNGLGENBUFFERSPROC glGenBuffers; - PFNGLBINDBUFFERPROC glBindBuffer; - PFNGLBUFFERDATAPROC glBufferData; - PFNGLBUFFERSUBDATAPROC glBufferSubData; - PFNGLDELETEBUFFERSPROC glDeleteBuffers; - PFNGLCOPYBUFFERSUBDATAPROC glCopyBufferSubData; - PFNGLMAPBUFFERPROC glMapBuffer; - PFNGLUNMAPBUFFERPROC glUnmapBuffer; + const glExtensions* gl; }; }; #endif diff --git a/third-party-libs/FragmentFramework/include/graphics/bufferObjectPool.h b/dependencies/FragmentFramework/include/graphics/bufferObjectPool.hpp similarity index 51% rename from third-party-libs/FragmentFramework/include/graphics/bufferObjectPool.h rename to dependencies/FragmentFramework/include/graphics/bufferObjectPool.hpp index 19d865e..b7eb941 100644 --- a/third-party-libs/FragmentFramework/include/graphics/bufferObjectPool.h +++ b/dependencies/FragmentFramework/include/graphics/bufferObjectPool.hpp @@ -7,16 +7,15 @@ #ifndef FFW_BUFFER_OBJECT_POOL #define FFW_BUFFER_OBJECT_POOL -#include "../dll.h" -#include -#include +#include "../config.h" +#include "../gl/extensions.hpp" #include -#include /*! @ingroup Graphics */ namespace ffw { + class renderContext; /*! @memberof ffw @ingroup Graphics @@ -31,101 +30,92 @@ namespace ffw { @ingroup Graphics */ - bool init(GLenum ObjectType, GLsizei Increment); + bool init(const renderContext* Context, unsigned int ObjectType, int Increment); /*! @memberof bufferObjectPool @ingroup Graphics */ - bool isLoaded() const; + bool isCreated() const; /*! @memberof bufferObjectPool @ingroup Graphics */ - GLsizei allocate(GLsizei Size); + int allocate(int Size); /*! @memberof bufferObjectPool @ingroup Graphics */ - bool release(GLsizei Offset); + bool release(int Offset); /*! @memberof bufferObjectPool @ingroup Graphics */ - bool uploadData(const void* Data, GLsizei Offset, GLsizei Size); + bool uploadData(const void* Data, int Offset, int Size); /*! @memberof bufferObjectPool @ingroup Graphics */ - bool deleteBuffer(); + bool destroy(); /*! @memberof bufferObjectPool @ingroup Graphics */ - void bind(); + void bind() const; /*! @memberof bufferObjectPool @ingroup Graphics */ - void unbind(); + void unbind() const; /*! @memberof bufferObjectPool @ingroup Graphics */ - GLuint getBuffer() const; + unsigned int getBuffer() const; /*! @memberof bufferObjectPool @ingroup Graphics */ - GLsizei getSize() const; + int getSize() const; /*! @memberof bufferObjectPool @ingroup Graphics */ - GLenum getObjectType() const; + unsigned int getObjectType() const; struct block { - GLsizei pos; - GLsizei size; + int pos; + int size; }; private: - //bool createBuffer(GLsizei Size); - GLsizei getAligned(GLsizei Value); - void increaseSize(GLsizei Min); - void decreaseSize(GLsizei Max); + int getAligned(int Value); + void increaseSize(int Min); + void decreaseSize(int Max); - void createThisBuffer(GLuint* Ptr, GLenum Type, GLsizei Size); - void deleteThisBuffer(GLuint* Ptr); - void copyThisBuffer(GLuint From, GLuint To, GLsizei FromOffset, GLsizei ToOffset, GLsizei Size); - void clearMemory(GLuint Ptr, GLsizei Pos, GLsizei Size); + void createThisBuffer(unsigned int* Ptr, GLenum Type, int Size); + void deleteThisBuffer(unsigned int* Ptr); + void copyThisBuffer(unsigned int From, unsigned int To, int FromOffset, int ToOffset, int Size); + void clearMemory(unsigned int Ptr, int Pos, int Size); - GLenum objectType; + unsigned int objectType; bool loaded; - // IBO pointer - GLuint buffer; - // Size of buffer - GLsizei bufferSize; - GLsizei increment; + unsigned int buffer; + int bufferSize; + int increment; bool initialized; - std::vector* blocks; - - PFNGLGENBUFFERSPROC glGenBuffers; - PFNGLBINDBUFFERPROC glBindBuffer; - PFNGLBUFFERDATAPROC glBufferData; - PFNGLBUFFERSUBDATAPROC glBufferSubData; - PFNGLDELETEBUFFERSPROC glDeleteBuffers; - PFNGLCOPYBUFFERSUBDATAPROC glCopyBufferSubData; + std::vector blocks; + const glExtensions* gl; }; }; #endif diff --git a/dependencies/FragmentFramework/include/graphics/font.hpp b/dependencies/FragmentFramework/include/graphics/font.hpp new file mode 100644 index 0000000..e7b8ed9 --- /dev/null +++ b/dependencies/FragmentFramework/include/graphics/font.hpp @@ -0,0 +1,179 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_GRAPHICS_FONT +#define FFW_GRAPHICS_FONT + +#include "../config.h" +#include "texture2D.hpp" +#include "bufferObject.hpp" +#include "shader.hpp" +#include "text.hpp" + +/*! + @ingroup Graphics +*/ +namespace ffw { + class renderContext; + /*! + @memberof ffw + @ingroup Graphics + */ + class FFW_API font { + public: + font(); + virtual ~font(); + /*! + @memberof font + @ingroup Graphics + + */ + bool init(const renderContext* Context); + /*! + @memberof font + @ingroup Graphics + + */ + bool isCreated() const; + /*! + @memberof font + @ingroup Graphics + + */ + bool destroy(); + /*! + @memberof font + @ingroup Graphics + + */ + bool loadFromData(const unsigned char* Buffer, size_t Length, int Points, int Dpi); + /*! + @memberof font + @ingroup Graphics + + */ + bool loadFromFile(const std::string& Path, int Points, int Dpi); + /*! + @memberof font + @ingroup Graphics + + */ + void getCharVertices(unsigned short C, vec4f& v0, vec4f& v1, vec4f& v2, vec4f& v3); + /*! + @memberof font + @ingroup Graphics + + */ + bool createTextBuffer(text* Text, const std::string& Message); + /*! + @memberof font + @ingroup Graphics + + */ + bool createTextBuffer(text* Text, const std::wstring& Message); + /*! + @memberof font + @ingroup Graphics + + */ + int getCharAdvance(unsigned short C) const; + /*! + @memberof font + @ingroup Graphics + + */ + int getCharVboId(unsigned short C) const; + /*! + @memberof font + @ingroup Graphics + + */ + void setLineHeight(int Height); + /*! + @memberof font + @ingroup Graphics + + */ + int getLineHeight() const; + /*! + @memberof font + @ingroup Graphics + + */ + const texture2D* getFontTexture() const; + /*! + @memberof font + @ingroup Graphics + + */ + const bufferObject* getFontVbo() const; + /*! + @memberof font + @ingroup Graphics + + */ + int getFontSize() const; + /*! + @memberof font + @ingroup Graphics + + */ + int getFontDPI() const; + /*! + @memberof font + @ingroup Graphics + + */ + size_t getNumOfGlyphs() const; + /*! + @memberof font + @ingroup Graphics + + */ + vec2i getStringSize(const std::string& Str) const; + /*! + @memberof font + @ingroup Graphics + + */ + vec2i getStringSize(const std::wstring& Str) const; + + private: + bool loadFontFace(void* FontFacePtr, int Error, int Points, int Dpi); + bool renderGlyph(void* FontFacePtr, int glyphIndex, int Unicode); + bool constructVbo(); + + std::wstring tempChar; + + struct charStruct{ + unsigned char* pixels; + short texWidth; + short texHeight; + short width; + short height; + short x; + short y; + short left; + short bearing; + short advance; + unsigned short unicode; + }; + + std::vector allCharacters; + ffw::texture2D fontTexture; + ffw::bufferObject fontVBO; + int fontSizePixels; + int fontSizePoints; + int fontDpi; + int fontLineHeight; + + bool loaded; + static const int unicodeMax = 65536; + unsigned short unicodePtr[unicodeMax]; + }; +}; +#endif + diff --git a/dependencies/FragmentFramework/include/graphics/framebuffer.hpp b/dependencies/FragmentFramework/include/graphics/framebuffer.hpp new file mode 100644 index 0000000..351a80b --- /dev/null +++ b/dependencies/FragmentFramework/include/graphics/framebuffer.hpp @@ -0,0 +1,118 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_GRAPHICS_FRAMEBUFFER +#define FFW_GRAPHICS_FRAMEBUFFER + +#include "../config.h" +#include +#include "texture2D.hpp" +#include "../gl/extensions.hpp" + +/*! + @ingroup Graphics +*/ +namespace ffw { + class renderContext; + /*! + @memberof ffw + @ingroup Graphics + + @brief Object on graphics card that can serve as offscreen rendering + + @details Framebuffer (or short FBO) contains single or multiple attachments. + These attachments are textures, either color texture or depth buffer. The maximum + number of possible attachments is defined by each graphics card. Framebuffer can + be activated or deactivated while render context is active. Everything drawn while + the FBO is active will not be rendered directly on the screen, instead the result + will be stored in attachment(s). The framebuffer texture can be used as any other + 2D texture. + */ + class FFW_API framebuffer { + public: + framebuffer(); + ~framebuffer(); + /*! + @memberof framebuffer + @ingroup Graphics + */ + bool init(const renderContext* Context); + /*! + @memberof framebuffer + @ingroup Graphics + */ + bool isCreated() const; + /*! + @memberof framebuffer + @ingroup Graphics + @return True on success + */ + bool create(); + /*! + @memberof framebuffer + @ingroup Graphics + @return True if attachment has been added + */ + bool addDepthAttachment(const ffw::texture2D* DepthTexture); + /*! + @memberof framebuffer + @ingroup Graphics + */ + bool addColorAttachment(const ffw::texture2D* ColorTexture); + /*! + @memberof framebuffer + @ingroup Graphics + */ + bool checkStatus(); + /*! + @memberof framebuffer + @ingroup Graphics + @return True on success + */ + bool resize(); + /*! + @memberof framebuffer + @ingroup Graphics + + @brief Deletes the framebuffer + + @warning Render context must be active and be on + same thread before calling this function. + + @return True on success + */ + bool destroy(); + /*! + @memberof framebuffer + @ingroup Graphics + + @brief Activates the framebuffer + + @warning Render context must be active and be on + same thread before calling this function. + */ + void bind(); + /*! + @memberof framebuffer + @ingroup Graphics + + @brief Clears all attachments + + @warning Render context must be active and be on + same thread before calling this function. + */ + void unbind(); + + private: + // Is framebuffer loaded? + bool initialized; + bool created; + unsigned int fbo; + int colorCount; + const glExtensions* gl; + }; +}; +#endif diff --git a/dependencies/FragmentFramework/include/graphics/shader.hpp b/dependencies/FragmentFramework/include/graphics/shader.hpp new file mode 100644 index 0000000..7bd7b42 --- /dev/null +++ b/dependencies/FragmentFramework/include/graphics/shader.hpp @@ -0,0 +1,371 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_GRAPHICS_SHADER +#define FFW_GRAPHICS_SHADER + +#include "../config.h" +#include "../math/math.h" +#include "../gl/extensions.hpp" +#include + +/*! + @ingroup Graphics +*/ +namespace ffw { + class renderContext; + /*! + @memberof ffw + @ingroup Graphics + */ + class FFW_API shader { + public: + shader(); + virtual ~shader(); + /*! + @memberof shader + @ingroup Graphics + + */ + bool init(renderContext* Context); + /*! + @memberof shader + @ingroup Graphics + + */ + bool isCreated() const; + /*! + @memberof shader + @ingroup Graphics + + */ + const std::string& getCompileLog() const; + /*! + @memberof shader + @ingroup Graphics + + */ + bool loadFromFile(const std::string& geomPath, const std::string& vertPath, const std::string& fragPath); + /*! + @memberof shader + @ingroup Graphics + + */ + bool loadFromData(const std::string& geomData, const std::string& vertData, const std::string& fragData); + /*! + @memberof shader + @ingroup Graphics + + */ + bool destroy(); + /*! + @memberof shader + @ingroup Graphics + + */ + unsigned int getProgram() const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setAttributePointerf(int Location, int Size, int Stride, int Offset) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setAttributeDivisor(unsigned int Index, unsigned int Divisor) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void drawArrays(unsigned int Mode, int First, int Count) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void drawArraysInstanced(unsigned int Mode, int First, int Count, int InstanceCount) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void drawElements(unsigned int Mode, int Count, unsigned int Type, const void* Indices) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void drawElementsRange(unsigned int Mode, unsigned int Start, unsigned int End, int Count, unsigned int Type, const void* Indices) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void drawElementsInstanced(unsigned int Mode, int Count, unsigned int Type, const void* Indices, int InstanceCount) const; + /*! + @memberof shader + @ingroup Graphics + + */ + bool begin() const; + /*! + @memberof shader + @ingroup Graphics + + */ + bool end() const; + /*! + @memberof shader + @ingroup Graphics + + */ + int getUniformLocation(const char* Name) const; + /*! + @memberof shader + @ingroup Graphics + + */ + int getAttributeLocation(const char* Name) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform1f(int location, float value) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform1fv(int location, const float* array, int length) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform1i(int location, int value) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform1iv(int location, const int* array, int length) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform2f(int location, float x, float y) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform2fv(int location, const float* array, int length) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform2i(int location, int x, int y) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform2iv(int location, const int* array, int length) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform3f(int location, float x, float y, float z) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform3fv(int location, const float* array, int length) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform3i(int location, int x, int y, int z) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform3iv(int location, const int* array, int length) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform4f(int location, float x, float y, float z, float w) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform4fv(int location, const float* array, int length) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform4i(int location, int x, int y, int z, int w) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform4iv(int location, const int* array, int length) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform2f(int location, const ffw::vec2f& vec) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform2fv(int location, const ffw::vec2f* array, int length) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform2i(int location, const ffw::vec2i& vec) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform2iv(int location, const ffw::vec2i* array, int length) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform3f(int location, const ffw::vec3f& vec) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform3fv(int location, const ffw::vec3f* array, int length) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform3i(int location, const ffw::vec3i& vec) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform3iv(int location, const ffw::vec3i* array, int length) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform4f(int location, const ffw::vec4f& vec) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform4fv(int location, const ffw::vec4f* array, int length) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform4i(int location, const ffw::vec4i& vec) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform4iv(int location, const ffw::vec4i* array, int length) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform4f(int location, const ffw::color& vec) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniform4fv(int location, const ffw::color* array, int length) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniformMatrix2fv(int location, const float* mat, int length) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniformMatrix3fv(int location, const float* mat, int length) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniformMatrix4fv(int location, const float* mat, int length) const; + /*! + @memberof shader + @ingroup Graphics + + */ + void setUniformMatrix4fv(int location, const mat4 mat, int length) const; + + private: + // Compile shader + bool compileShader(unsigned int &thisShader, const char* data, unsigned int shaderType); + // Check for shader compilation errors + bool checkForShaderErrors(unsigned int thisShader, std::string* ErrorStr); + // Check for program linking errors + bool checkForProgramErrors(std::string* ErrorStr); + // Is shader loaded? + bool loaded; + // Shader program + unsigned int program; + // Geometry shader + unsigned int geomShader; + // Vertex shader + unsigned int vertShader; + // Fragment shader + unsigned int fragShader; + // Is geometry shader loaded? + bool usingGeom; + // Is vertex shader loaded? + bool usingVert; + // Is fragment shader loaded? + bool usingFrag; + std::string* errorLogStr; + + bool initialized; + + const glExtensions* gl; + }; +}; +#endif diff --git a/third-party-libs/FragmentFramework/include/graphics/graphicsText.h b/dependencies/FragmentFramework/include/graphics/text.hpp similarity index 90% rename from third-party-libs/FragmentFramework/include/graphics/graphicsText.h rename to dependencies/FragmentFramework/include/graphics/text.hpp index ba7e33a..0166b63 100644 --- a/third-party-libs/FragmentFramework/include/graphics/graphicsText.h +++ b/dependencies/FragmentFramework/include/graphics/text.hpp @@ -7,15 +7,14 @@ #ifndef FFW_GRAPHICS_TEXT #define FFW_GRAPHICS_TEXT -#include "../dll.h" -#include -#include "bufferObject.h" -#include +#include "../config.h" +#include "bufferObject.hpp" /*! @ingroup Graphics */ namespace ffw { + class renderContext; /*! @memberof ffw @ingroup Graphics @@ -29,7 +28,7 @@ namespace ffw { @ingroup Graphics */ - bool init(); + bool init(const renderContext* Context); /*! @memberof text @ingroup Graphics @@ -41,7 +40,7 @@ namespace ffw { @ingroup Graphics */ - void deleteText(); + void destroy(); /*! @memberof text @ingroup Graphics diff --git a/third-party-libs/FragmentFramework/include/graphics/graphicsTextureBase.h b/dependencies/FragmentFramework/include/graphics/texture.hpp similarity index 73% rename from third-party-libs/FragmentFramework/include/graphics/graphicsTextureBase.h rename to dependencies/FragmentFramework/include/graphics/texture.hpp index 6cfd899..b80889c 100644 --- a/third-party-libs/FragmentFramework/include/graphics/graphicsTextureBase.h +++ b/dependencies/FragmentFramework/include/graphics/texture.hpp @@ -7,16 +7,14 @@ #ifndef FFW_GRAPHICS_TEXTURE_BASE #define FFW_GRAPHICS_TEXTURE_BASE -#include "../dll.h" -#include "../utilities/loadSaveBmp.h" - -#include -#include +#include "../config.h" +#include "../gl/extensions.hpp" /*! @ingroup Graphics */ namespace ffw { + class renderContext; /*! @memberof ffw @ingroup Graphics @@ -28,12 +26,12 @@ namespace ffw { @sa texture2D, texture2DArray */ - class FFW_API textureBase { + class FFW_API texture { public: - textureBase(); - virtual ~textureBase(); + texture(); + virtual ~texture(); /*! - @memberof textureBase + @memberof texture @ingroup Graphics @brief Initializes required GL extensions @@ -46,9 +44,9 @@ namespace ffw { @return True on success */ - bool init(); + bool init(const renderContext* Context); /*! - @memberof textureBase + @memberof texture @ingroup Graphics @const @@ -56,9 +54,9 @@ namespace ffw { @return True if loaded */ - bool isLoaded() const; + bool isCreated() const; /*! - @memberof textureBase + @memberof texture @ingroup Graphics @brief Deletes the texture from GPU memory @@ -68,9 +66,9 @@ namespace ffw { @return True on success */ - bool deleteTexture(); + bool destroy(); /*! - @memberof textureBase + @memberof texture @ingroup Graphics @brief Binds the texture @@ -80,9 +78,9 @@ namespace ffw { @warning Render context must be active and be on same thread before calling this function. */ - bool bind(); + bool bind() const; /*! - @memberof textureBase + @memberof texture @ingroup Graphics @brief Unbinds the texture @@ -96,39 +94,33 @@ namespace ffw { @warning Render context must be active and be on same thread before calling this function. */ - void unbind(); + void unbind() const; /*! - @memberof textureBase + @memberof texture @ingroup Graphics @const @brief Returns the GL integer pointer to the texture - - @return GL integer pointer to the texture */ - GLuint getTexture() const; + unsigned int getHandle() const; /*! - @memberof textureBase + @memberof texture @ingroup Graphics @const - @brief Returns width of the texture - - @return Width + @brief Returns width */ - GLsizei getWidth() const; + int getWidth() const; /*! - @memberof textureBase + @memberof texture @ingroup Graphics @const - @brief Returns height of the texture - - @return Height + @brief Returns height */ - GLsizei getHeight() const; + int getHeight() const; /*! - @memberof textureBase + @memberof texture @ingroup Graphics @const @@ -139,9 +131,9 @@ namespace ffw { @return Number of layers if texture is array, otherwise zero. */ - GLsizei getLayers() const; + int getLayers() const; /*! - @memberof textureBase + @memberof texture @ingroup Graphics @const @@ -152,9 +144,9 @@ namespace ffw { @return Depth of texture if is 3D, otherwise zero. */ - GLsizei getDepth() const; + int getDepth() const; /*! - @memberof textureBase + @memberof texture @ingroup Graphics @const @@ -166,9 +158,9 @@ namespace ffw { @return Internal format */ - GLenum getInternalFormat() const; + unsigned int getInternalFormat() const; /*! - @memberof textureBase + @memberof texture @ingroup Graphics @const @@ -179,9 +171,9 @@ namespace ffw { @return Internal format */ - GLenum getFormat() const; + unsigned int getFormat() const; /*! - @memberof textureBase + @memberof texture @ingroup Graphics @const @@ -192,9 +184,9 @@ namespace ffw { @return Internal format */ - GLenum getPixelFormat() const; + unsigned int getPixelFormat() const; /*! - @memberof textureBase + @memberof texture @ingroup Graphics @const @@ -205,9 +197,9 @@ namespace ffw { @return Internal format */ - GLenum getTextureFormat() const; + unsigned int getTextureFormat() const; /*! - @memberof textureBase + @memberof texture @ingroup Graphics @brief Sets the environment mode @@ -219,9 +211,9 @@ namespace ffw { @param [in] Name Name of the parameter @param [in] Value Value */ - void setEnvParami(GLenum Target, GLenum Name, GLint Value); + void setEnvParami(unsigned int Target, unsigned int Name, int Value); /*! - @memberof textureBase + @memberof texture @ingroup Graphics @brief Sets the environment mode @@ -233,9 +225,9 @@ namespace ffw { @param [in] Name Name of the parameter @param [in] Value Value */ - void setEnvParamf(GLenum Target, GLenum Name, GLfloat Value); + void setEnvParamf(unsigned int Target, unsigned int Name, float Value); /*! - @memberof textureBase + @memberof texture @ingroup Graphics @brief Sets the texture parameter @@ -246,9 +238,9 @@ namespace ffw { @param [in] Name Name of the parameter @param [in] Value Value */ - void setTexParami(GLenum Name, GLint Value); + void setTexParami(unsigned int Name, int Value); /*! - @memberof textureBase + @memberof texture @ingroup Graphics @brief Sets the texture parameter @@ -259,9 +251,9 @@ namespace ffw { @param [in] Name Name of the parameter @param [in] Value Value */ - void setTexParamf(GLenum Name, GLfloat Value); + void setTexParamf(unsigned int Name, float Value); /*! - @memberof textureBase + @memberof texture @ingroup Graphics @brief Generates mipmaps @@ -274,22 +266,20 @@ namespace ffw { protected: bool loaded; bool instance; - GLenum textureFormat; - GLenum internalFormat; - GLenum format; - GLenum pixelFormat; - GLuint buffer; - - GLsizei width; - GLsizei height; - GLsizei depth; - GLsizei layers; + unsigned int textureFormat; + unsigned int internalFormat; + unsigned int format; + unsigned int pixelFormat; + unsigned int buffer; + + int width; + int height; + int depth; + int layers; bool mipmaps; bool initialized; - PFNGLTEXIMAGE3DPROC glTexImage3D; - PFNGLTEXSUBIMAGE3DPROC glTexSubImage3D; - PFNGLGENERATEMIPMAPPROC glGenerateMipmap; + const glExtensions* gl; }; }; #endif diff --git a/third-party-libs/FragmentFramework/include/graphics/graphicsTexture2D.h b/dependencies/FragmentFramework/include/graphics/texture2D.hpp similarity index 67% rename from third-party-libs/FragmentFramework/include/graphics/graphicsTexture2D.h rename to dependencies/FragmentFramework/include/graphics/texture2D.hpp index e7c9b4a..ff9a280 100644 --- a/third-party-libs/FragmentFramework/include/graphics/graphicsTexture2D.h +++ b/dependencies/FragmentFramework/include/graphics/texture2D.hpp @@ -7,7 +7,7 @@ #ifndef FFW_GRAPHICS_TEXTURE_2D #define FFW_GRAPHICS_TEXTURE_2D -#include "graphicsTextureBase.h" +#include "texture.hpp" /*! @ingroup Graphics @@ -16,10 +16,10 @@ namespace ffw { /*! @memberof ffw @ingroup Graphics - @inherit textureBase - @sa textureBase + @inherit texture + @sa texture */ - class FFW_API texture2D: public textureBase { + class FFW_API texture2D: public texture { public: texture2D(); ~texture2D(); @@ -27,23 +27,6 @@ namespace ffw { @memberof texture2D @ingroup Graphics - @brief Creates instance to already existing 2D texture - - @details This function only copies the data. Original texture - will not be changed! - - @param [in] Buffer GL integer pointer to the target texture - @param [in] Width Width of the target texture - @param [in] Height Height of the target texture - @param [in] InternalFormat Internal format of the target texture (e.g, GL_RGB8, GL_RGBA16, ...) - @param [in] Format Format of the target texture (e.g, GL_RGB, GL_RGBA, GL_BGR, ...) - @param [in] PixelFormat Pixel format of the target texture (e.g, GL_BYTE, GL_FLOAT, GL_UNSIGNED_SHORT_4_4_4_4, ...) - */ - void makeInstance(GLuint Buffer, GLsizei Width, GLsizei Height, GLenum InternalFormat, GLenum Format, GLenum PixelFormat); - /*! - @memberof texture2D - @ingroup Graphics - @brief Creates empty texture @warning Render context must be active and be on diff --git a/third-party-libs/FragmentFramework/include/graphics/graphicsTexture2DArray.h b/dependencies/FragmentFramework/include/graphics/texture2DArray.hpp similarity index 68% rename from third-party-libs/FragmentFramework/include/graphics/graphicsTexture2DArray.h rename to dependencies/FragmentFramework/include/graphics/texture2DArray.hpp index 9505e67..8ad01e4 100644 --- a/third-party-libs/FragmentFramework/include/graphics/graphicsTexture2DArray.h +++ b/dependencies/FragmentFramework/include/graphics/texture2DArray.hpp @@ -7,7 +7,7 @@ #ifndef FFW_GRAPHICS_TEXTURE_2D_ARRAY #define FFW_GRAPHICS_TEXTURE_2D_ARRAY -#include "graphicsTextureBase.h" +#include "texture.hpp" /*! @ingroup Graphics @@ -16,10 +16,10 @@ namespace ffw { /*! @memberof ffw @ingroup Graphics - @inherit textureBase - @sa textureBase + @inherit texture + @sa texture */ - class FFW_API texture2DArray: public textureBase { + class FFW_API texture2DArray: public texture { public: texture2DArray(); ~texture2DArray(); @@ -27,23 +27,6 @@ namespace ffw { @memberof texture2DArray @ingroup Graphics - @brief Creates instance to already existing 2D array texture - - @details This function only copies the data. Original texture - will not be changed! - - @param [in] Buffer GL integer pointer to the target texture - @param [in] Width Width of the target texture - @param [in] Height Height of the target texture - @param [in] InternalFormat Internal format of the target texture (e.g, GL_RGB8, GL_RGBA16, ...) - @param [in] Format Format of the target texture (e.g, GL_RGB, GL_RGBA, GL_BGR, ...) - @param [in] PixelFormat Pixel format of the target texture (e.g, GL_BYTE, GL_FLOAT, GL_UNSIGNED_SHORT_4_4_4_4, ...) - */ - bool makeInstance(GLuint Buffer, GLsizei Width, GLsizei Height, GLsizei Layers, GLenum InternalFormat, GLenum Format, GLenum PixelFormat); - /*! - @memberof texture2DArray - @ingroup Graphics - @brief Creates empty texture @warning Render context must be active and be on diff --git a/third-party-libs/FragmentFramework/include/math/color.h b/dependencies/FragmentFramework/include/math/color.h similarity index 99% rename from third-party-libs/FragmentFramework/include/math/color.h rename to dependencies/FragmentFramework/include/math/color.h index c9f9486..5fef663 100644 --- a/third-party-libs/FragmentFramework/include/math/color.h +++ b/dependencies/FragmentFramework/include/math/color.h @@ -140,6 +140,7 @@ namespace ffw { color& normalize(); }; }; -#endif #include "color.inl" + +#endif diff --git a/third-party-libs/FragmentFramework/include/math/color.inl b/dependencies/FragmentFramework/include/math/color.inl similarity index 98% rename from third-party-libs/FragmentFramework/include/math/color.inl rename to dependencies/FragmentFramework/include/math/color.inl index e6b4f3b..b1ca5b9 100644 --- a/third-party-libs/FragmentFramework/include/math/color.inl +++ b/dependencies/FragmentFramework/include/math/color.inl @@ -4,9 +4,6 @@ * Licensed under the MIT License */ -#ifndef FFW_COLOR_INL -#define FFW_COLOR_INL - ///============================================================================= inline ffw::color::color(){ r = 1.0f; @@ -149,5 +146,3 @@ inline ffw::color& ffw::color::normalize(){ if(a > 1.0f)a = 1.0f; return *this; } - -#endif diff --git a/third-party-libs/FragmentFramework/include/math/constants.h b/dependencies/FragmentFramework/include/math/constants.h similarity index 100% rename from third-party-libs/FragmentFramework/include/math/constants.h rename to dependencies/FragmentFramework/include/math/constants.h diff --git a/third-party-libs/FragmentFramework/include/math/baseFunctions.h b/dependencies/FragmentFramework/include/math/functions.h similarity index 71% rename from third-party-libs/FragmentFramework/include/math/baseFunctions.h rename to dependencies/FragmentFramework/include/math/functions.h index 1d329dd..2e3ea43 100644 --- a/third-party-libs/FragmentFramework/include/math/baseFunctions.h +++ b/dependencies/FragmentFramework/include/math/functions.h @@ -30,48 +30,6 @@ namespace ffw{ @ingroup Math @inline - @brief Linear interpolation of 2D vector - - @param [in] A First value - @param [in] B Second value - @param [in] Weight Alpha value - - @return Interpolated 2D vector - */ - template vec2 lerp(const vec2& A, const vec2& B, float Weight); - /*! - @memberof ffw - @ingroup Math - @inline - - @brief Linear interpolation of 3D vector - - @param [in] A First value - @param [in] B Second value - @param [in] Weight Alpha value - - @return Interpolated 3D vector - */ - template vec3 lerp(const vec3& A, const vec3& B, float Weight); - /*! - @memberof ffw - @ingroup Math - @inline - - @brief Linear interpolation of 4D vector - - @param [in] A First value - @param [in] B Second value - @param [in] Weight Alpha value - - @return Interpolated 4D vector - */ - template vec4 lerp(const vec4& A, const vec4& B, float Weight); - /*! - @memberof ffw - @ingroup Math - @inline - @brief Dot product of two 2D vectors @param [in] V1 First vector @@ -111,7 +69,7 @@ namespace ffw{ @ingroup Math @inline - @brief Normalizes 2D vectors + @brief Normalizes 2D vector @param [in] V Vector to normalize @@ -123,7 +81,7 @@ namespace ffw{ @ingroup Math @inline - @brief Normalizes 3D vectors + @brief Normalizes 3D vector @param [in] V Vector to normalize @@ -135,7 +93,7 @@ namespace ffw{ @ingroup Math @inline - @brief Normalizes 4D vectors + @brief Normalizes 4D vector @param [in] V Vector to normalize @@ -220,7 +178,7 @@ namespace ffw{ @return Projection matrix */ - mat4 makeProjectionMatrix(float FieldOfView, float Aspect, float Near, float Far); + mat4 FFW_API makeProjectionMatrix(float FieldOfView, float Aspect, float Near, float Far); /*! @memberof ffw @ingroup Math @@ -238,7 +196,7 @@ namespace ffw{ @return View matrix */ - mat4 makeLookAtMatrix(const vec3f& Eyes, const vec3f& Target, const vec3f& UpVector); + mat4 FFW_API makeLookAtMatrix(const vec3f& Eyes, const vec3f& Target, const vec3f& UpVector); /*! @memberof ffw @ingroup Math @@ -254,7 +212,7 @@ namespace ffw{ @return View matrix */ - mat4 makeFpsCameraMatrix(const vec3f& Eyes, float Pitch, float Yaw); + mat4 FFW_API makeFpsCameraMatrix(const vec3f& Eyes, float Pitch, float Yaw); /*! @memberof ffw @ingroup Math @@ -266,7 +224,7 @@ namespace ffw{ @return Random integer */ - uint32_t getRandom(); + unsigned long FFW_API getRandom(); /*! @memberof ffw @ingroup Math @@ -278,7 +236,7 @@ namespace ffw{ @return Random float */ - float getRandomf(); + float FFW_API getRandomf(); /*! @memberof ffw @ingroup Math @@ -293,7 +251,7 @@ namespace ffw{ @return Random integer */ - uint32_t getRandom(uint32_t Min, uint32_t Max); + unsigned long FFW_API getRandom(unsigned long Min, unsigned long Max); /*! @memberof ffw @ingroup Math @@ -301,31 +259,7 @@ namespace ffw{ @brief Sets randomness seed */ - void setRandomSeed(uint32_t Seed); - /*! - @memberof ffw - @ingroup Math - @inline - - @brief Returns absolute value of float - - @param [in] Val Value - - @return Absolute value - */ - float getAbsf(float Val); - /*! - @memberof ffw - @ingroup Math - @inline - - @brief Returns absolute value of double - - @param [in] Val Value - - @return Absolute value - */ - double getAbsd(double Val); + void FFW_API setRandomSeed(unsigned long Seed); /*! @memberof ffw @ingroup Math @@ -341,39 +275,23 @@ namespace ffw{ @return Clamped value */ - template float clamp(T Val, T Min, T Max); + template T clamp(T Val, T Min, T Max); /*! @memberof ffw @ingroup Math @inline - @brief Clamps value of float + @brief Clamps value between 0.0 <-> 1.0 range @details Returns 0.0 if value is less than 0.0 or returns 1.0 if value is greater than 1.0f - Otherwise returns same value. + Otherwise returns same value. Must be float or double. @param [in] Val Value @return Clamped value */ - float clampf(float Val); - /*! - @memberof ffw - @ingroup Math - @inline - - @brief Clamps value of double - - @details Returns 0.0 if value is less than 0.0 - or returns 1.0 if value is greater than 1.0f - Otherwise returns same value. - - @param [in] Val Value - - @return Clamped value - */ - double clampd(double Val); + template T clamp(T Val); /*! @memberof ffw @ingroup Math @@ -396,22 +314,124 @@ namespace ffw{ // Prints: Remapped value of 0.87 is 87 @endcode */ - float remap(float Value, float InMin, float InMax, float OutMin, float OutMax); + template T remap(T Value, T InMin, T InMax, T OutMin, T OutMax); /*! @memberof ffw @ingroup Math @inline */ - uint32_t nextPowOfTwo(uint32_t Value); + unsigned long nextPowOfTwo(unsigned long Value); /*! @memberof ffw @ingroup Math @inline */ mat4 makeRotationMatrix(const quaternion& Q); + /*! + @memberof ffw + @ingroup Math + @inline + */ + template vec3 vec2ToVec3(const vec2& Vec); + /*! + @memberof ffw + @ingroup Math + @inline + */ + template vec4 vec3ToVec4(const vec3& Vec); + /*! + @memberof ffw + @ingroup Math + @inline + */ + template vec3 vec2ToVec3(const vec2& Vec, T Z); + /*! + @memberof ffw + @ingroup Math + @inline + */ + template vec4 vec3ToVec4(const vec3& Vec, T W); + /*! + @memberof ffw + @ingroup Math + @inline + */ + template vec3 vec4ToVec3(const vec4& Vec); + /*! + @memberof ffw + @ingroup Math + @inline + */ + template vec2 vec3ToVec2(const vec3& Vec); + /*! + @memberof ffw + @ingroup Math + @inline + */ + vec3f quatToVec3(const quaternion& Quat); + /*! + @memberof ffw + @ingroup Math + @inline + */ + vec4f quatToVec4(const quaternion& Quat); + /*! + @memberof ffw + @ingroup Math + @inline + */ + template quaternion vec4ToQuat(const vec4& Vec); + /*! + @memberof ffw + @ingroup Math + @inline + */ + unsigned short byteSwap16(unsigned short Value); + /*! + @memberof ffw + @ingroup Math + @inline + */ + unsigned long byteSwap32(unsigned long Value); + /*! + @memberof ffw + @ingroup Math + @inline + */ + unsigned long long byteSwap64(unsigned long long Value); + /*! + @memberof ffw + @ingroup Math + @inline + */ + template std::ostream& operator << (std::ostream& os, const vec2& V); + /*! + @memberof ffw + @ingroup Math + @inline + */ + template std::ostream& operator << (std::ostream& os, const vec3& V); + /*! + @memberof ffw + @ingroup Math + @inline + */ + template std::ostream& operator << (std::ostream& os, const vec4& V); + /*! + @memberof ffw + @ingroup Math + @inline + */ + std::ostream& operator << (std::ostream& os, const color& C); + /*! + @memberof ffw + @ingroup Math + @inline + */ + std::ostream& operator << (std::ostream& os, const quaternion& Q); }; -#include "baseFunctions.inl" +#include "functions.inl" #endif diff --git a/third-party-libs/FragmentFramework/include/math/baseFunctions.inl b/dependencies/FragmentFramework/include/math/functions.inl similarity index 62% rename from third-party-libs/FragmentFramework/include/math/baseFunctions.inl rename to dependencies/FragmentFramework/include/math/functions.inl index 0eeee64..57a174c 100644 --- a/third-party-libs/FragmentFramework/include/math/baseFunctions.inl +++ b/dependencies/FragmentFramework/include/math/functions.inl @@ -13,36 +13,6 @@ inline T ffw::lerp(const T& A, const T& B, float Weight) { return (1-Weight)*A + Weight*B; } -///============================================================================= -template -inline ffw::vec2 ffw::lerp(const ffw::vec2& A, const ffw::vec2& B, float Weight) { - vec2 result; - result.x = A.x*(1-Weight) + B.x*Weight; - result.y = A.y*(1-Weight) + B.y*Weight; - return result; -} - -///============================================================================= -template -inline ffw::vec3 ffw::lerp(const ffw::vec3& A, const ffw::vec3& B, float Weight) { - vec3 result; - result.x = A.x*(1-Weight) + B.x*Weight; - result.y = A.y*(1-Weight) + B.y*Weight; - result.z = A.z*(1-Weight) + B.z*Weight; - return result; -} - -///============================================================================= -template -inline ffw::vec4 ffw::lerp(const ffw::vec4& A, const ffw::vec4& B, float Weight) { - vec4 result; - result.x = A.x*(1-Weight) + B.x*Weight; - result.y = A.y*(1-Weight) + B.y*Weight; - result.z = A.z*(1-Weight) + B.z*Weight; - result.w = A.w*(1-Weight) + B.w*Weight; - return result; -} - ///============================================================================= template inline float dot(const ffw::vec2& V1, const ffw::vec2& V2){ @@ -152,153 +122,148 @@ inline float ffw::angleRad(const ffw::vec2& V1, const ffw::vec2& V2){ } ///============================================================================= -inline ffw::mat4 ffw::makeProjectionMatrix(float FieldOfView, float Aspect, float Near, float Far){ - float halfFov = FieldOfView/2.0f; - float tanFov = tanf(halfFov*(float)DEG_TO_RAD); - ffw::mat4 mat; - mat.ptr[0] = 1.0f / (Aspect * tanFov); - mat.ptr[5] = 1.0f / tanFov; - mat.ptr[10] = (Near + Far) / (Near - Far); - mat.ptr[11] = -1.0f; - mat.ptr[14] = (2.0f * Far * Near) / (Near - Far); - return mat; +template +inline T ffw::clamp(T Val, T Min, T Max){ + return std::max(Min, std::min(Val, Max)); } ///============================================================================= -inline ffw::mat4 ffw::makeLookAtMatrix(const ffw::vec3f& Eyes, const ffw::vec3f& Target, const ffw::vec3f& UpVector){ - ffw::mat4 mat; - ffw::vec3f f = ffw::normalize(Target - Eyes); - ffw::vec3f s = ffw::normalize(ffw::cross(f, UpVector)); - ffw::vec3f u = ffw::cross(s, f); - - mat[0] = s.x; - mat[4] = s.y; - mat[8] = s.z; - mat[3] = 0.0f; - mat[1] = u.x; - mat[5] = u.y; - mat[9] = u.z; - mat[7] = 0.0f; - mat[2] = -f.x; - mat[6] = -f.y; - mat[10] = -f.z; - mat[11] = 0.0f; - mat[12] = -ffw::dot(s, Eyes); - mat[13] = -ffw::dot(u, Eyes); - mat[14] = ffw::dot(f, Eyes); - mat[15] = 1.0f; - - return mat; +template +inline T ffw::remap(T Value, T InMin, T InMax, T OutMin, T OutMax){ + return (Value - InMin) / (InMax - InMin) * (OutMax - OutMin) + OutMin; } ///============================================================================= -inline ffw::mat4 ffw::makeFpsCameraMatrix(const ffw::vec3f& Eyes, float Pitch, float Yaw){ - float cPitch = (float)cos(Pitch*DEG_TO_RAD); - float sPitch = (float)sin(Pitch*DEG_TO_RAD); - float cYaw = (float)cos(Yaw*DEG_TO_RAD); - float sYaw = (float)sin(Yaw*DEG_TO_RAD); - - ffw::mat4 mat; - ffw::vec3f s(cYaw, 0, -sYaw); - ffw::vec3f u(sYaw * sPitch, cPitch, cYaw * sPitch); - ffw::vec3f f(sYaw * cPitch, -sPitch, cPitch * cYaw); - - mat[0] = s.x; - mat[4] = s.y; - mat[8] = s.z; - mat[3] = 0.0f; - mat[1] = u.x; - mat[5] = u.y; - mat[9] = u.z; - mat[7] = 0.0f; - mat[2] = -f.x; - mat[6] = -f.y; - mat[10] = -f.z; - mat[11] = 0.0f; - mat[12] = -ffw::dot(s, Eyes); - mat[13] = -ffw::dot(u, Eyes); - mat[14] = ffw::dot(f, Eyes); - mat[15] = 1.0f; - - return mat; +inline unsigned long ffw::nextPowOfTwo(unsigned long Value){ + unsigned long P = 1; + while(P < Value){ + P *= 2; + } + return P; } ///============================================================================= -inline uint32_t ffw::getRandom() { - uint32_t t; +inline ffw::mat4 ffw::makeRotationMatrix(const ffw::quaternion& Q){ + mat4 m; + + m[0] = 1.0f - 2.0f * (Q.y * Q.y + Q.z * Q.z); m[4] = 2.0f * (Q.x * Q.y + Q.z * Q.w); m[8] = 2.0f * (Q.x * Q.z - Q.y * Q.w); + m[1] = 2.0f * (Q.x * Q.y - Q.z * Q.w); m[5] = 1.0f - 2.0f * (Q.x * Q.x + Q.z * Q.z); m[9] = 2.0f * (Q.y * Q.z + Q.x * Q.w); + m[2] = 2.0f * (Q.x * Q.z + Q.y * Q.w); m[6] = 2.0f * (Q.y * Q.z - Q.x * Q.w); m[10] = 1.0f - 2.0f * (Q.x * Q.x + Q.y * Q.y); - t = randX ^ (randX << 11); - randX = randY; randY = randZ; randZ = randW; - return randW = randW ^ (randW >> 19) ^ (t ^ (t >> 8)); + return m; } ///============================================================================= -inline float ffw::getRandomf(){ - return float(getRandom())/4294967296.0f; +template +inline ffw::vec3 ffw::vec2ToVec3(const vec2& Vec){ + return vec3(Vec.x, Vec.y, 0); } ///============================================================================= -inline uint32_t ffw::getRandom(uint32_t Min, uint32_t Max){ - return getRandom() % Max + Min; +template +inline ffw::vec4 ffw::vec3ToVec4(const ffw::vec3& Vec){ + return vec4(Vec.x, Vec.y, Vec.z, 0); } ///============================================================================= -inline float ffw::getAbsf(float Val){ - if(Val > 0.0f)return Val; - else return -Val; +template +inline ffw::vec3 ffw::vec2ToVec3(const ffw::vec2& Vec, T Z){ + return vec3(Vec.x, Vec.y, Z); } ///============================================================================= -inline double ffw::getAbsd(double Val){ - if(Val > 0.0)return Val; - else return -Val; +template +inline ffw::vec4 ffw::vec3ToVec4(const ffw::vec3& Vec, T W){ + return vec4(Vec.x, Vec.y, Vec.z, W); } ///============================================================================= template -inline float ffw::clamp(T Val, T Min, T Max){ - if(Val < Min)return Min; - else if(Val > Max)return Max; - return Val; +inline ffw::vec3 ffw::vec4ToVec3(const ffw::vec4& Vec){ + return vec3(Vec.x, Vec.y, Vec.z); } ///============================================================================= -inline float ffw::clampf(float Val){ - if(Val < 0.0f)return 0.0f; - else if(Val > 1.0f)return 1.0f; - return Val; +template +inline ffw::vec2 ffw::vec3ToVec2(const ffw::vec3& Vec){ + return vec3(Vec.x, Vec.y); } ///============================================================================= -inline double ffw::clampd(double Val){ - if(Val < 0.0)return 0.0f; - else if(Val > 1.0)return 1.0; - return Val; +inline ffw::vec3f ffw::quatToVec3(const ffw::quaternion& Quat){ + return vec3f(Quat.x, Quat.y, Quat.z); } ///============================================================================= -inline float ffw::remap(float Value, float InMin, float InMax, float OutMin, float OutMax){ - return (Value - InMin) / (InMax - InMin) * (OutMax - OutMin) + OutMin; +inline ffw::vec4f ffw::quatToVec4(const ffw::quaternion& Quat){ + return vec4f(Quat.x, Quat.y, Quat.z, Quat.w); } ///============================================================================= -inline uint32_t ffw::nextPowOfTwo(uint32_t Value){ - uint32_t P = 1; - while(P < Value){ - P *= 2; - } - return P; +template ffw::quaternion ffw::vec4ToQuat(const ffw::vec4& Vec){ + return quaternion(Vec.x, Vec.y, Vec.z, Vec.w); } ///============================================================================= -inline ffw::mat4 ffw::makeRotationMatrix(const ffw::quaternion& Q){ - mat4 m; +#ifdef _USING_MSVC +inline unsigned short ffw::byteSwap16(unsigned short Value){ + return _byteswap_ushort(Value); +} - m[0] = 1.0f - 2.0f * (Q.y * Q.y + Q.z * Q.z); m[4] = 2.0f * (Q.x * Q.y + Q.z * Q.w); m[8] = 2.0f * (Q.x * Q.z - Q.y * Q.w); - m[1] = 2.0f * (Q.x * Q.y - Q.z * Q.w); m[5] = 1.0f - 2.0f * (Q.x * Q.x + Q.z * Q.z); m[9] = 2.0f * (Q.y * Q.z + Q.x * Q.w); - m[2] = 2.0f * (Q.x * Q.z + Q.y * Q.w); m[6] = 2.0f * (Q.y * Q.z - Q.x * Q.w); m[10] = 1.0f - 2.0f * (Q.x * Q.x + Q.y * Q.y); +inline unsigned long ffw::byteSwap32(unsigned long Value){ + return _byteswap_ulong(Value); +} - return m; +inline unsigned long long ffw::byteSwap64(unsigned long long Value){ + return _byteswap_uint64(Value); +} +#endif + +#ifdef _USING_MINGW +inline unsigned short ffw::byteSwap16(unsigned short Value){ + return __builtin_bswap16(Value); +} + +inline unsigned long ffw::byteSwap32(unsigned long Value){ + return __builtin_bswap32(Value); +} + +inline unsigned long long ffw::byteSwap64(unsigned long long Value){ + return __builtin_bswap64(Value); +} +#endif + +///============================================================================= +template +inline std::ostream& ffw::operator << (std::ostream& os, const ffw::vec2& V){ + os << V.x << ", " << V.y; + return os; +} + +///============================================================================= +template +inline std::ostream& ffw::operator << (std::ostream& os, const ffw::vec3& V){ + os << V.x << ", " << V.y << ", " << V.z; + return os; +} + +///============================================================================= +template +inline std::ostream& ffw::operator << (std::ostream& os, const ffw::vec4& V){ + os << V.x << ", " << V.y << ", " << V.z << ", " << V.w; + return os; +} + +///============================================================================= +inline std::ostream& ffw::operator << (std::ostream& os, const ffw::quaternion& Q){ + os << Q.x << ", " << Q.y << ", " << Q.z << ", " << Q.w; + return os; +} + +///============================================================================= +inline std::ostream& ffw::operator << (std::ostream& os, const ffw::color& C){ + os << C.r << ", " << C.g << ", " << C.b << ", " << C.a; + return os; } #endif diff --git a/third-party-libs/FragmentFramework/include/math/mat4.h b/dependencies/FragmentFramework/include/math/mat4.h similarity index 95% rename from third-party-libs/FragmentFramework/include/math/mat4.h rename to dependencies/FragmentFramework/include/math/mat4.h index e027041..c2ae52e 100644 --- a/third-party-libs/FragmentFramework/include/math/mat4.h +++ b/dependencies/FragmentFramework/include/math/mat4.h @@ -96,6 +96,12 @@ namespace ffw { @inline */ template vec4 operator * (const vec4& V) const; + /*! + @memberof mat4 + @ingroup Math + @inline + */ + template vec3 operator * (const vec3& V) const; /*! @memberof mat4 @ingroup Math @@ -140,7 +146,8 @@ namespace ffw { mat4& inverse(); }; }; -#endif #include "mat4.inl" +#endif + diff --git a/third-party-libs/FragmentFramework/include/math/mat4.inl b/dependencies/FragmentFramework/include/math/mat4.inl similarity index 97% rename from third-party-libs/FragmentFramework/include/math/mat4.inl rename to dependencies/FragmentFramework/include/math/mat4.inl index 4609a1f..373a5d6 100644 --- a/third-party-libs/FragmentFramework/include/math/mat4.inl +++ b/dependencies/FragmentFramework/include/math/mat4.inl @@ -4,9 +4,6 @@ * Licensed under the MIT License */ -#ifndef FFW_MAT4_INL -#define FFW_MAT4_INL - ///============================================================================= inline ffw::mat4::mat4(){ ptr[0] = 1.0f; ptr[4] = 0.0f; ptr[8] = 0.0f; ptr[12] = 0.0f; @@ -130,6 +127,16 @@ template inline ffw::vec4 ffw::mat4::operator * (const ffw::vec4 return r; } +///============================================================================= +template inline ffw::vec3 ffw::mat4::operator * (const ffw::vec3& V) const { + ffw::vec3f r; + r.x = V.x*ptr[0] + V.y*ptr[4] + V.z*ptr[8] + ptr[12]; + r.y = V.x*ptr[1] + V.y*ptr[5] + V.z*ptr[9] + ptr[13]; + r.z = V.x*ptr[2] + V.y*ptr[6] + V.z*ptr[10] + ptr[14]; + //r.w = V.x*ptr[3] + V.y*ptr[7] + V.z*ptr[11] + V.w*ptr[15]; + return r; +} + ///============================================================================= inline float& ffw::mat4::operator [] (int x){ return ptr[x]; @@ -224,7 +231,7 @@ inline ffw::mat4& ffw::mat4::inverse(){ float det = ptr[0] * inv[0] + ptr[1] * inv[4] + ptr[2] * inv[8] + ptr[3] * inv[12]; - det = 1.0 / det; + det = 1.0f / det; for(int i = 0; i < 16; i++)ptr[i] = inv[i] * det; @@ -261,5 +268,3 @@ inline ffw::mat4& ffw::mat4::inverse(){ return *this; } - -#endif diff --git a/third-party-libs/FragmentFramework/include/math/math.h b/dependencies/FragmentFramework/include/math/math.h similarity index 65% rename from third-party-libs/FragmentFramework/include/math/math.h rename to dependencies/FragmentFramework/include/math/math.h index 74a95e9..19e88ef 100644 --- a/third-party-libs/FragmentFramework/include/math/math.h +++ b/dependencies/FragmentFramework/include/math/math.h @@ -7,18 +7,17 @@ #ifndef FFW_MATH #define FFW_MATH -#include #include -#include -#include "constants.h" +#include #include -#include +#include "../config.h" /*! @defgroup Math @brief Functions and structures for mathematics */ +#include "constants.h" #include "quaternion.h" #include "vec2.h" #include "vec3.h" @@ -28,18 +27,7 @@ #include "var.h" #include "range.h" #include "memPool.h" - -/*! - @ingroup Math -*/ -namespace ffw { - extern uint32_t randX; - extern uint32_t randY; - extern uint32_t randZ; - extern uint32_t randW; -}; - -#include "baseFunctions.h" -#include "typesOperators.h" +#include "functions.h" +#include "stringMath.h" #endif diff --git a/third-party-libs/FragmentFramework/include/math/memPool.h b/dependencies/FragmentFramework/include/math/memPool.h similarity index 100% rename from third-party-libs/FragmentFramework/include/math/memPool.h rename to dependencies/FragmentFramework/include/math/memPool.h diff --git a/third-party-libs/FragmentFramework/include/math/memPool.inl b/dependencies/FragmentFramework/include/math/memPool.inl similarity index 98% rename from third-party-libs/FragmentFramework/include/math/memPool.inl rename to dependencies/FragmentFramework/include/math/memPool.inl index 413d11b..717a468 100644 --- a/third-party-libs/FragmentFramework/include/math/memPool.inl +++ b/dependencies/FragmentFramework/include/math/memPool.inl @@ -4,9 +4,6 @@ * Licensed under the MIT License */ -#ifndef FFW_MEM_POOL_INL -#define FFW_MEM_POOL_INL - ///============================================================================= template ffw::memPool::memPool(size_t Increment, size_t Aligment){ buffer = NULL; @@ -116,5 +113,3 @@ template void ffw::memPool::decreaseSize(size_t Max){ buffer = NULL; } } - -#endif diff --git a/third-party-libs/FragmentFramework/include/math/quaternion.h b/dependencies/FragmentFramework/include/math/quaternion.h similarity index 59% rename from third-party-libs/FragmentFramework/include/math/quaternion.h rename to dependencies/FragmentFramework/include/math/quaternion.h index bd849f8..d175c2f 100644 --- a/third-party-libs/FragmentFramework/include/math/quaternion.h +++ b/dependencies/FragmentFramework/include/math/quaternion.h @@ -141,6 +141,16 @@ namespace ffw { @return Reference to object */ quaternion& rotateRad(float Rad, float X, float Y, float Z); + /*! + @memberof quaternion + @ingroup Math + @inline + + @brief Unary minus + + @return Quaternion + */ + quaternion operator - () const; /*! @memberof quaternion @ingroup Math @@ -150,7 +160,7 @@ namespace ffw { @return Product of multiplication */ - quaternion operator * (const quaternion& Quat) const; + quaternion operator * (const quaternion& Quat) const; /*! @memberof quaternion @ingroup Math @@ -166,6 +176,86 @@ namespace ffw { @ingroup Math @inline + @brief Multiplication by scalar + + @return Product of multiplication + */ + quaternion operator * (float Value) const; + /*! + @memberof quaternion + @ingroup Math + @inline + + @brief Multiplication assigment by scalar + + @return Reference to object + */ + quaternion& operator *= (float Value); + /*! + @memberof quaternion + @ingroup Math + @inline + + @brief Addition + + @return Product of addition + */ + quaternion operator + (const quaternion& Quat) const; + /*! + @memberof quaternion + @ingroup Math + @inline + + @brief Addition assigment + + @return Reference to object + */ + quaternion& operator += (const quaternion& Quat); + /*! + @memberof quaternion + @ingroup Math + @inline + + @brief Subtraction + + @return Product of substraction + */ + quaternion operator - (const quaternion& Quat) const; + /*! + @memberof quaternion + @ingroup Math + @inline + + @brief Subtraction assigment + + @return Reference to object + */ + quaternion& operator -= (const quaternion& Quat); + /*! + @memberof quaternion + @ingroup Math + @inline + + @brief Division by scalar + + @return Product of multiplication + */ + quaternion operator / (float Value) const; + /*! + @memberof quaternion + @ingroup Math + @inline + + @brief Division assigment by scalar + + @return Reference to object + */ + quaternion& operator /= (float Value); + /*! + @memberof quaternion + @ingroup Math + @inline + @brief Normalizes the quaternion */ void normalize(); @@ -181,9 +271,51 @@ namespace ffw { @param [out] Yaw Yaw in degrees */ void getEuler(float* Roll, float* Pitch, float* Yaw) const; + /*! + @memberof quaternion + @ingroup Math + @inline + + @brief Returns length of quaternion + */ + float getLength() const; + /*! + @memberof quaternion + @ingroup Math + @inline + + @brief Returns squared length of quaternion + */ + float getLengthSquared() const; + /*! + @memberof quaternion + @ingroup Math + @inline + + @brief Returns conjugate + */ + quaternion getConjugate() const; + /*! + @memberof quaternion + @ingroup Math + @inline + + @brief Returns inversed quaternion + */ + quaternion getInversed() const; + /*! + @memberof quaternion + @ingroup Math + @inline + + @brief Inverses this quaternion + + @return Reference to object + */ + quaternion& inverse(); }; }; -#endif - #include "quaternion.inl" + +#endif diff --git a/dependencies/FragmentFramework/include/math/quaternion.inl b/dependencies/FragmentFramework/include/math/quaternion.inl new file mode 100644 index 0000000..f7fb980 --- /dev/null +++ b/dependencies/FragmentFramework/include/math/quaternion.inl @@ -0,0 +1,272 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +///============================================================================= +inline ffw::quaternion::quaternion(){ + x = 0.0f; + y = 0.0f; + z = 0.0f; + w = 1.0f; +} + +///============================================================================= +inline ffw::quaternion::quaternion(float X, float Y, float Z, float W){ + x = X; + y = Y; + z = Z; + w = W; +} + +///============================================================================= +inline ffw::quaternion::quaternion(const quaternion& Quat){ + x = Quat.x; + y = Quat.y; + z = Quat.z; + w = Quat.w; +} + +///============================================================================= +inline void ffw::quaternion::set(float X, float Y, float Z, float W){ + x = X; + y = Y; + z = Z; + w = W; +} + +///============================================================================= +inline void ffw::quaternion::set(const quaternion& Quat){ + x = Quat.x; + y = Quat.y; + z = Quat.z; + w = Quat.w; +} + +///============================================================================= +inline ffw::quaternion& ffw::quaternion::rotate(float Deg, float X, float Y, float Z){ + double angle = Deg*DEG_TO_RAD; + double result = sin(angle/2.0); + x = float(X * result); + y = float(Y * result); + z = float(Z * result); + w = float(cos(angle/2.0)); + normalize(); + return *this; +} + +///============================================================================= +inline ffw::quaternion& ffw::quaternion::rotateRad(float Rad, float X, float Y, float Z){ + double result = sin(Rad/2.0); + x = float(X * result); + y = float(Y * result); + z = float(Z * result); + w = float(cos(Rad/2.0)); + normalize(); + return *this; +} + +///============================================================================= +inline ffw::quaternion ffw::quaternion::operator - () const{ + quaternion result; + + result.x = -x; + result.y = -y; + result.z = -z; + result.w = -w; + + return result; +} + +///============================================================================= +inline ffw::quaternion ffw::quaternion::operator * (const quaternion& Quat) const{ + quaternion result; + + result.x = Quat.w*x + Quat.x*w + Quat.y*z - Quat.z*y; + result.y = Quat.w*y - Quat.x*z + Quat.y*w + Quat.z*x; + result.z = Quat.w*z + Quat.x*y - Quat.y*x + Quat.z*w; + result.w = Quat.w*w - Quat.x*x - Quat.y*y - Quat.z*z; + + return result; +} + +///============================================================================= +inline ffw::quaternion& ffw::quaternion::operator *= (const quaternion& Quat){ + float rx = Quat.w*x + Quat.x*w + Quat.y*z - Quat.z*y; + float ry = Quat.w*y - Quat.x*z + Quat.y*w + Quat.z*x; + float rz = Quat.w*z + Quat.x*y - Quat.y*x + Quat.z*w; + float rw = Quat.w*w - Quat.x*x - Quat.y*y - Quat.z*z; + + x = rx; + y = ry; + z = rz; + w = rw; + + return *this; +} + +///============================================================================= +inline ffw::quaternion ffw::quaternion::operator * (float Value) const{ + quaternion result; + + result.x = x*Value; + result.y = y*Value; + result.z = z*Value; + result.w = w*Value; + + return result; +} + +///============================================================================= +inline ffw::quaternion& ffw::quaternion::operator *= (float Value){ + x *= Value; + y *= Value; + z *= Value; + w *= Value; + + return *this; +} + +///============================================================================= +inline ffw::quaternion ffw::quaternion::operator + (const quaternion& Quat) const{ + quaternion result; + + result.x = x + Quat.x; + result.y = y + Quat.y; + result.z = z + Quat.z; + result.w = w + Quat.w; + + return result; +} + +///============================================================================= +inline ffw::quaternion& ffw::quaternion::operator += (const quaternion& Quat){ + x += Quat.x; + y += Quat.y; + z += Quat.z; + w += Quat.w; + + return *this; +} + +///============================================================================= +inline ffw::quaternion ffw::quaternion::operator - (const quaternion& Quat) const{ + quaternion result; + + result.x = x - Quat.x; + result.y = y - Quat.y; + result.z = z - Quat.z; + result.w = w - Quat.w; + + return result; +} + +///============================================================================= +inline ffw::quaternion& ffw::quaternion::operator -= (const quaternion& Quat){ + x -= Quat.x; + y -= Quat.y; + z -= Quat.z; + w -= Quat.w; + + return *this; +} + +///============================================================================= +inline ffw::quaternion ffw::quaternion::operator / (float Value) const{ + quaternion result; + float val = 1.0f / Value; + + result.x = x*val; + result.y = y*val; + result.z = z*val; + result.w = w*val; + + return result; +} + +///============================================================================= +inline ffw::quaternion& ffw::quaternion::operator /= (float Value){ + float val = 1.0f / Value; + + x *= val; + y *= val; + z *= val; + w *= val; + + return *this; +} + +///============================================================================= +inline void ffw::quaternion::normalize(){ + float n = 1.0f/sqrt(x*x+y*y+z*z+w*w); + x = x * n; + y = y * n; + z = z * n; + w = w * n; +} + +///============================================================================= +inline void ffw::quaternion::getEuler(float* Roll, float* Pitch, float* Yaw) const{ + // http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/ + float test = x*y + z*w; + double heading; + double attitude; + double bank; + + if (test > 0.499) { // singularity at north pole + heading = 2.0f * atan2(x, w); + attitude = M_PI_2; + bank = 0; + + } else if (test < -0.499) { // singularity at south pole + heading = -2.0f * atan2(x, w); + attitude = - M_PI_2; + bank = 0; + + } else { + float sqx = x * x; + float sqy = y * y; + float sqz = z * z; + heading = atan2(2.0f * y * w - 2.0f * x * z, 1.0f - 2.0f*sqy - 2.0f*sqz); + attitude = asin(2*test); + bank = atan2(2.0f*x * w - 2.0f * y * z, 1.0f - 2.0f*sqx - 2.0f*sqz); + } + + *Roll = float(attitude *DEG_TO_RAD); + *Pitch = float(heading *DEG_TO_RAD); + *Yaw = float(bank *DEG_TO_RAD); +} + +///============================================================================= +inline float ffw::quaternion::getLength() const { + return sqrt(x*x + y*y + z*z + w*w); +} + +///============================================================================= +inline float ffw::quaternion::getLengthSquared() const { + return x*x + y*y + z*z + w*w; +} + +///============================================================================= +inline ffw::quaternion ffw::quaternion::getConjugate() const { + quaternion result; + + result.x = -x; + result.y = -y; + result.z = -z; + result.w = w; + + return result; +} + +///============================================================================= +inline ffw::quaternion ffw::quaternion::getInversed() const { + return getConjugate() / getLengthSquared(); +} + +///============================================================================= +inline ffw::quaternion& ffw::quaternion::inverse(){ + *this = getConjugate() / getLengthSquared(); + return *this; +} diff --git a/third-party-libs/FragmentFramework/include/math/range.h b/dependencies/FragmentFramework/include/math/range.h similarity index 100% rename from third-party-libs/FragmentFramework/include/math/range.h rename to dependencies/FragmentFramework/include/math/range.h index 9139c8f..d09124c 100644 --- a/third-party-libs/FragmentFramework/include/math/range.h +++ b/dependencies/FragmentFramework/include/math/range.h @@ -74,6 +74,6 @@ namespace ffw{ }; }; -#endif - #include "range.inl" + +#endif diff --git a/third-party-libs/FragmentFramework/include/math/range.inl b/dependencies/FragmentFramework/include/math/range.inl similarity index 100% rename from third-party-libs/FragmentFramework/include/math/range.inl rename to dependencies/FragmentFramework/include/math/range.inl diff --git a/dependencies/FragmentFramework/include/math/stringMath.h b/dependencies/FragmentFramework/include/math/stringMath.h new file mode 100644 index 0000000..7656263 --- /dev/null +++ b/dependencies/FragmentFramework/include/math/stringMath.h @@ -0,0 +1,192 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_STRING_MATH +#define FFW_STRING_MATH + +#include +#include +#include +#include +#include +#include +#include +#include + +/*! + @ingroup Math +*/ +namespace ffw{ + /*! + @memberof ffw + @ingroup Math + @inline + + @brief Converts string value to arithmetic value. + + @param [in] Str String to convert + + @return Arithmetic value + + @code + std::string str = "123.456"; + // To float + float f = ffw::stringToVal(str); + // To double + double d = ffw::stringToVal(str); + @endcode + */ + template T stringToVal(const std::string& Str); + + template <> float stringToVal (const std::string& Str); + template <> double stringToVal (const std::string& Str); + template <> long double stringToVal (const std::string& Str); + template <> short stringToVal (const std::string& Str); + template <> int stringToVal (const std::string& Str); + template <> long stringToVal (const std::string& Str); + template <> long long stringToVal (const std::string& Str); + template <> unsigned short stringToVal (const std::string& Str); + template <> unsigned int stringToVal (const std::string& Str); + template <> unsigned long stringToVal (const std::string& Str); + template <> unsigned long long stringToVal (const std::string& Str); + /*! + @memberof ffw + @ingroup Math + @inline + + @brief Converts arithmetic value to string. + + @param [in] value Value to convert + + @return std::string + */ + template std::string valToString(const T& Value); + /*! + @memberof ffw + @ingroup Math + @inline + + @brief Converts arithmetic value to string. + + @param [in] Value Value to convert + @param [in] Dec Number of decimals + + @return std::string + */ + template std::string valToString(T Value, unsigned int Dec); + /*! + @memberof ffw + @ingroup Math + @inline + + @brief Converts hex string value to arithmetic value. + + @param [in] Str String to convert + + @return Arithmetic value + */ + template T hexToVal(const std::string& Str); + /*! + @memberof ffw + @ingroup Math + @inline + + @brief Converts arithmetic value to hex string. + + @param [in] Value Arithmetic value to convert + + @return Hex string + */ + template std::string valToHex(const T& Value); + /*! + @memberof ffw + @ingroup Math + @inline + + @brief Tokenize the string + + @details Create tokens from string based on provided delimiter. + + @param [in] Line String to extract tokens from + @param [in] Delim Token delimiter + + @return std::vector of tokens + + @code + std::string str = " this is a sentence! "; + // Split string to tokens by space + std::vector tokens = ffw::getTokens(str, ' '); + // Print tokens + for(const auto& token : tokens){ + std::cout << token << std::endl; + } + // This will print: + // "this" + // "is" + // "a" + // "sentence!" + @endcode + */ + template std::vector getTokens(const T& Line, char Delim); + /*! + @memberof ffw + @ingroup Math + @inline + */ + template unsigned int getTokensNum(const T& Line, char Delim); + /*! + @memberof ffw + @ingroup Math + @inline + + @brief Converts multi-byte string to single-byte ANSI string. + + @param [in] Str Multi-byte string to convert + + @return Converted ANSI string + */ + std::string wstrToAnsi(const std::wstring& Str); + /*! + @memberof ffw + @ingroup Math + @inline + + @brief Converts ANSI single-byte string to multi-byte string. + + @param [in] Str String to convert + + @return Converted multi-byte string + */ + std::wstring ansiToWstr(const std::string& Str); + /*! + @memberof ffw + @ingroup Math + @inline + + @brief Converts multi-byte string to single-byte UTF-8 string. + + @param [in] Str Multi-byte string to convert + + @return Converted UTF-8 string + */ + std::string wstrToUtf8(const std::wstring& Str); + /*! + @memberof ffw + @ingroup Math + @inline + + @brief Converts UTF-8 single-byte string to multi-byte string. + + @param [in] Str String to convert + + @return Converted multi-byte string + */ + std::wstring utf8ToWstr(const std::string& Str); +}; + +#include "stringMath.inl" + +#endif diff --git a/dependencies/FragmentFramework/include/math/stringMath.inl b/dependencies/FragmentFramework/include/math/stringMath.inl new file mode 100644 index 0000000..0072fae --- /dev/null +++ b/dependencies/FragmentFramework/include/math/stringMath.inl @@ -0,0 +1,124 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +///============================================================================= +template <> inline float ffw::stringToVal (const std::string& Str){return std::stof(Str);} +template <> inline double ffw::stringToVal (const std::string& Str){return std::stod(Str);} +template <> inline long double ffw::stringToVal (const std::string& Str){return std::stold(Str);} +template <> inline short ffw::stringToVal (const std::string& Str){return std::stoi(Str);} +template <> inline int ffw::stringToVal (const std::string& Str){return std::stoi(Str);} +template <> inline long ffw::stringToVal (const std::string& Str){return std::stol(Str);} +template <> inline long long ffw::stringToVal (const std::string& Str){return std::stoll(Str);} +template <> inline unsigned short ffw::stringToVal (const std::string& Str){return (unsigned short)std::stoul(Str);} +template <> inline unsigned int ffw::stringToVal (const std::string& Str){return std::stoul(Str);} +template <> inline unsigned long ffw::stringToVal (const std::string& Str){return std::stoul(Str);} +template <> inline unsigned long long ffw::stringToVal (const std::string& Str){return std::stoull(Str);} + +///============================================================================= +template +inline std::string ffw::valToString(const T& Value){ + return std::to_string(Value); +} + +///============================================================================= +template +inline std::string ffw::valToString(T Value, unsigned int Dec){ + std::ostringstream ostr; + ostr.precision(Dec); + ostr << std::fixed << Value; + return ostr.str(); +} + +///============================================================================= +template +inline T ffw::hexToVal(const std::string& Str) { + try { + return std::stoul(Str, nullptr, 16); + } catch (std::invalid_argument e){ + return 0; + } catch (std::out_of_range e){ + return 0; + } + return 0; +} + +///============================================================================= +template +inline std::string ffw::valToHex(const T& Value) { + std::stringstream ss; + ss << std::hex << Value; + std::string h = ss.str(); + if(h.size() < sizeof(T)*2){ + return std::string(sizeof(T)*2 - h.size(), '0') + h; + } + return h; +} + +///============================================================================= +template +inline std::vector ffw::getTokens(const T& Line, char Delim){ + std::vector vec; + T temp; + for(unsigned int i = 0; i < Line.size(); i++){ + if(Line[i] != Delim)temp += Line[i]; + else if(temp.size() > 0){ + vec.push_back(temp); + temp = ""; + } + if(i == Line.size()-1 && Line[i] != Delim)vec.push_back(temp); + } + return vec; +} + +///============================================================================= +template +inline unsigned int ffw::getTokensNum(const T& Line, char Delim){ + int num = 0; + int temp = 0; + for(unsigned int i = 0; i < Line.size(); i++){ + if(Line[i] != Delim)temp++; + else if(temp > 0){ + num++; + temp = 0; + } + if(i == Line.size()-1 && Line[i] != Delim)num++; + } + return num; +} + +///============================================================================= +inline std::string ffw::wstrToAnsi(const std::wstring& Str){ + int size = WideCharToMultiByte(CP_ACP, 0, Str.c_str(), Str.size(), NULL, 0, NULL, NULL); + std::string out(size, ' '); + WideCharToMultiByte(CP_ACP, 0, Str.c_str(), Str.size(), &out[0], size, 0, 0); + return out; + +} + +///============================================================================= +inline std::wstring ffw::ansiToWstr(const std::string& Str){ + int size = MultiByteToWideChar(CP_ACP, 0, Str.c_str(), Str.size(), NULL, 0); + std::wstring out(size, L' '); + MultiByteToWideChar(CP_ACP, 0, Str.c_str(), Str.size(), &out[0], size); + return out; +} + +///============================================================================= +inline std::string ffw::wstrToUtf8(const std::wstring& Str){ + int size = WideCharToMultiByte(CP_UTF8, 0, Str.c_str(), Str.size(), NULL, 0, NULL, NULL); + std::string out(size, ' '); + WideCharToMultiByte(CP_UTF8, 0, Str.c_str(), Str.size(), &out[0], size, 0, 0); + return out; + +} + +///============================================================================= +inline std::wstring ffw::utf8ToWstr(const std::string& Str){ + int size = MultiByteToWideChar(CP_UTF8, 0, Str.c_str(), Str.size(), NULL, 0); + std::wstring out(size, L' '); + MultiByteToWideChar(CP_UTF8, 0, Str.c_str(), Str.size(), &out[0], size); + return out; +} diff --git a/third-party-libs/FragmentFramework/include/math/var.h b/dependencies/FragmentFramework/include/math/var.h similarity index 99% rename from third-party-libs/FragmentFramework/include/math/var.h rename to dependencies/FragmentFramework/include/math/var.h index a5b931d..d6108e3 100644 --- a/third-party-libs/FragmentFramework/include/math/var.h +++ b/dependencies/FragmentFramework/include/math/var.h @@ -304,7 +304,7 @@ namespace ffw { @memberof varObject @ingroup Math */ - bool exists(const std::string& Key) const; + bool contains(const std::string& Key) const; /*! @memberof varObject @ingroup Math @@ -566,8 +566,8 @@ namespace ffw { }; }; -#endif - #include "var.inl" #include "varArray.inl" #include "varObject.inl" + +#endif diff --git a/third-party-libs/FragmentFramework/include/math/var.inl b/dependencies/FragmentFramework/include/math/var.inl similarity index 88% rename from third-party-libs/FragmentFramework/include/math/var.inl rename to dependencies/FragmentFramework/include/math/var.inl index f48d4cb..2be99ee 100644 --- a/third-party-libs/FragmentFramework/include/math/var.inl +++ b/dependencies/FragmentFramework/include/math/var.inl @@ -4,9 +4,6 @@ * Licensed under the MIT License */ -#ifndef FFW_VAR_INL -#define FFW_VAR_INL - ///============================================================================= inline ffw::var::var(){ varType = type::vNull; @@ -14,7 +11,13 @@ inline ffw::var::var(){ ///============================================================================= inline ffw::var::var(var&& Value){ - *this = Value; + varType = Value.getType(); + varTypeInt = std::move(Value.varTypeInt); + varTypeFloat = std::move(Value.varTypeFloat); + varTypeBool = std::move(Value.varTypeBool); + varTypeString = std::move(Value.varTypeString); + varTypeArray = std::move(Value.varTypeArray); + varTypeObject = std::move(Value.varTypeObject); } ///============================================================================= @@ -71,19 +74,14 @@ inline ffw::var::var(std::nullptr_t){ ///============================================================================= inline ffw::var& ffw::var::operator = (var&& Value){ - if(varType == type::vArray && Value.getType() != type::vArray)varTypeArray.clear(); - else if(varType == type::vObject && Value.getType() != type::vObject)varTypeObject.clear(); - varType = Value.getType(); - switch (varType){ - case type::vInt: varTypeInt = std::move(Value.varTypeInt); break; - case type::vFloat: varTypeFloat = std::move(Value.varTypeFloat); break; - case type::vBool: varTypeBool = std::move(Value.varTypeBool); break; - case type::vString: varTypeString = std::move(Value.varTypeString); break; - case type::vArray: varTypeArray = std::move(Value.varTypeArray); break; - case type::vObject: varTypeObject = std::move(Value.varTypeObject); break; - case type::vNull: break; - }; + varTypeInt = std::move(Value.varTypeInt); + varTypeFloat = std::move(Value.varTypeFloat); + varTypeBool = std::move(Value.varTypeBool); + varTypeString = std::move(Value.varTypeString); + varTypeArray = std::move(Value.varTypeArray); + varTypeObject = std::move(Value.varTypeObject); + return *this; } @@ -208,5 +206,3 @@ inline ffw::varArray& ffw::var::getAsArray(){ inline ffw::varObject& ffw::var::getAsObject(){ return varTypeObject; } - -#endif diff --git a/third-party-libs/FragmentFramework/include/math/varArray.inl b/dependencies/FragmentFramework/include/math/varArray.inl similarity index 99% rename from third-party-libs/FragmentFramework/include/math/varArray.inl rename to dependencies/FragmentFramework/include/math/varArray.inl index 412b797..9aa97d8 100644 --- a/third-party-libs/FragmentFramework/include/math/varArray.inl +++ b/dependencies/FragmentFramework/include/math/varArray.inl @@ -4,9 +4,6 @@ * Licensed under the MIT License */ -#ifndef FFW_VAR_ARRAY_INL -#define FFW_VAR_ARRAY_INL - ///============================================================================= inline ffw::varArray::varArray(){ } @@ -168,5 +165,3 @@ inline ffw::var& ffw::varArray::operator[] (size_t i){ inline const ffw::var& ffw::varArray::operator[] (size_t i) const { return varVec.at(i); } - -#endif diff --git a/third-party-libs/FragmentFramework/include/math/varObject.inl b/dependencies/FragmentFramework/include/math/varObject.inl similarity index 97% rename from third-party-libs/FragmentFramework/include/math/varObject.inl rename to dependencies/FragmentFramework/include/math/varObject.inl index 618ba25..e3c368f 100644 --- a/third-party-libs/FragmentFramework/include/math/varObject.inl +++ b/dependencies/FragmentFramework/include/math/varObject.inl @@ -4,9 +4,6 @@ * Licensed under the MIT License */ -#ifndef FFW_VAR_OBJECT_INL -#define FFW_VAR_OBJECT_INL - ///============================================================================= inline ffw::varObject::varObject(){ } @@ -112,7 +109,7 @@ inline std::map::reverse_iterator ffw::varObject::rend(){ } ///============================================================================= -inline bool ffw::varObject::exists(const std::string& Key) const { +inline bool ffw::varObject::contains(const std::string& Key) const { return varMap.find(Key) != varMap.end(); } @@ -133,6 +130,7 @@ inline ffw::varObject& ffw::varObject::operator = (ffw::varObject&& Object){ return *this; } +///============================================================================= inline ffw::varObject& ffw::varObject::operator = (std::initializer_list> List){ varMap = List; return *this; @@ -147,5 +145,3 @@ inline ffw::var& ffw::varObject::operator [] (const std::string& Key){ inline const ffw::var& ffw::varObject::operator [] (const std::string& Key) const { return varMap.at(Key); } - -#endif diff --git a/third-party-libs/FragmentFramework/include/math/vec2.h b/dependencies/FragmentFramework/include/math/vec2.h similarity index 99% rename from third-party-libs/FragmentFramework/include/math/vec2.h rename to dependencies/FragmentFramework/include/math/vec2.h index 1589fa6..61a7d5f 100644 --- a/third-party-libs/FragmentFramework/include/math/vec2.h +++ b/dependencies/FragmentFramework/include/math/vec2.h @@ -145,11 +145,11 @@ namespace ffw { @ingroup Math @inline - @brief Subtraction + @brief Returns negative value @details Returns negative value of vector if used as unary minus. - @return Negative vector + @return Inversed vector */ vec2 operator - () const; /*! @@ -444,6 +444,7 @@ namespace ffw { */ typedef vec2 vec2d; }; -#endif #include "vec2.inl" + +#endif diff --git a/third-party-libs/FragmentFramework/include/math/vec2.inl b/dependencies/FragmentFramework/include/math/vec2.inl similarity index 99% rename from third-party-libs/FragmentFramework/include/math/vec2.inl rename to dependencies/FragmentFramework/include/math/vec2.inl index b7704c0..2e1c89e 100644 --- a/third-party-libs/FragmentFramework/include/math/vec2.inl +++ b/dependencies/FragmentFramework/include/math/vec2.inl @@ -4,9 +4,6 @@ * Licensed under the MIT License */ -#ifndef FFW_VEC2_INL -#define FFW_VEC2_INL - ///============================================================================= template inline ffw::vec2::vec2(){ @@ -276,5 +273,3 @@ template inline ffw::vec2::operator ffw::vec2() const { return ffw::vec2((S)x, (S)y); } - -#endif diff --git a/third-party-libs/FragmentFramework/include/math/vec3.h b/dependencies/FragmentFramework/include/math/vec3.h similarity index 99% rename from third-party-libs/FragmentFramework/include/math/vec3.h rename to dependencies/FragmentFramework/include/math/vec3.h index b7dc694..2ac8c12 100644 --- a/third-party-libs/FragmentFramework/include/math/vec3.h +++ b/dependencies/FragmentFramework/include/math/vec3.h @@ -154,11 +154,11 @@ namespace ffw { @ingroup Math @inline - @brief Subtraction + @brief Returns negative value @details Returns negative value of vector if used as unary minus. - @return Negative vector + @return Inversed vector */ vec3 operator - () const; /*! @@ -526,7 +526,8 @@ namespace ffw { */ typedef vec3 vec3d; }; -#endif #include "vec3.inl" +#endif + diff --git a/third-party-libs/FragmentFramework/include/math/vec3.inl b/dependencies/FragmentFramework/include/math/vec3.inl similarity index 96% rename from third-party-libs/FragmentFramework/include/math/vec3.inl rename to dependencies/FragmentFramework/include/math/vec3.inl index 6a97837..ed942dc 100644 --- a/third-party-libs/FragmentFramework/include/math/vec3.inl +++ b/dependencies/FragmentFramework/include/math/vec3.inl @@ -4,9 +4,6 @@ * Licensed under the MIT License */ -#ifndef FFW_VEC3_INL -#define FFW_VEC3_INL - ///============================================================================= template inline ffw::vec3::vec3(){ @@ -264,8 +261,8 @@ inline ffw::vec3& ffw::vec3::rotateX(const float Deg){ T vy = y; T vz = z; //x = vx; - y = cos(Deg*0.01745329251)*vy - sin(Deg*0.01745329251)*vz; - z = sin(Deg*0.01745329251)*vy + cos(Deg*0.01745329251)*vz; + y = cos(Deg*0.01745329251f)*vy - sin(Deg*0.01745329251f)*vz; + z = sin(Deg*0.01745329251f)*vy + cos(Deg*0.01745329251f)*vz; return *this; } @@ -274,9 +271,9 @@ template inline ffw::vec3& ffw::vec3::rotateY(const float Deg){ T vx = x; T vz = z; - x = cos(Deg*0.01745329251)*vx + sin(Deg*0.01745329251)*vz; + x = cos(Deg*0.01745329251f)*vx + sin(Deg*0.01745329251f)*vz; //y = vy; - z = -sin(Deg*0.01745329251)*vx + cos(Deg*0.01745329251)*vz; + z = -sin(Deg*0.01745329251f)*vx + cos(Deg*0.01745329251f)*vz; return *this; } @@ -285,8 +282,8 @@ template inline ffw::vec3& ffw::vec3::rotateZ(const float Deg){ T vx = x; T vy = y; - x = cos(Deg*0.01745329251)*vx - sin(Deg*0.01745329251)*vy; - y = sin(Deg*0.01745329251)*vx + cos(Deg*0.01745329251)*vy; + x = cos(Deg*0.01745329251f)*vx - sin(Deg*0.01745329251f)*vy; + y = sin(Deg*0.01745329251f)*vx + cos(Deg*0.01745329251f)*vy; //z = vz; return *this; } @@ -396,5 +393,3 @@ template inline ffw::vec3::operator ffw::vec3() const { return ffw::vec3((S)x, (S)y, (S)z); } - -#endif diff --git a/third-party-libs/FragmentFramework/include/math/vec4.h b/dependencies/FragmentFramework/include/math/vec4.h similarity index 99% rename from third-party-libs/FragmentFramework/include/math/vec4.h rename to dependencies/FragmentFramework/include/math/vec4.h index 665e2a0..19a6a40 100644 --- a/third-party-libs/FragmentFramework/include/math/vec4.h +++ b/dependencies/FragmentFramework/include/math/vec4.h @@ -163,11 +163,11 @@ namespace ffw { @ingroup Math @inline - @brief Subtraction + @brief Returns negative value @details Returns negative value of vector if used as unary minus. - @return Negative vector + @return Inversed vector */ vec4 operator - () const; /*! @@ -438,7 +438,7 @@ namespace ffw { */ typedef vec4 vec4d; }; -#endif #include "vec4.inl" +#endif diff --git a/third-party-libs/FragmentFramework/include/math/vec4.inl b/dependencies/FragmentFramework/include/math/vec4.inl similarity index 99% rename from third-party-libs/FragmentFramework/include/math/vec4.inl rename to dependencies/FragmentFramework/include/math/vec4.inl index 905e81f..5ae6d32 100644 --- a/third-party-libs/FragmentFramework/include/math/vec4.inl +++ b/dependencies/FragmentFramework/include/math/vec4.inl @@ -4,9 +4,6 @@ * Licensed under the MIT License */ -#ifndef FFW_VEC4_INL -#define FFW_VEC4_INL - ///============================================================================= template inline ffw::vec4::vec4(){ @@ -303,6 +300,3 @@ template inline ffw::vec4::operator ffw::vec4() const { return ffw::vec4((S)x, (S)y, (S)z, (S)w); } - -#endif - diff --git a/third-party-libs/FragmentFramework/include/network/networkUtils.h b/dependencies/FragmentFramework/include/network/networkUtils.hpp similarity index 80% rename from third-party-libs/FragmentFramework/include/network/networkUtils.h rename to dependencies/FragmentFramework/include/network/networkUtils.hpp index 6e85305..6018496 100644 --- a/third-party-libs/FragmentFramework/include/network/networkUtils.h +++ b/dependencies/FragmentFramework/include/network/networkUtils.hpp @@ -7,7 +7,7 @@ #ifndef FFW_NETWORK_UTILS #define FFW_NETWORK_UTILS -#include "../dll.h" +#include "../config.h" #include #include @@ -34,12 +34,12 @@ namespace ffw { @memberof ffw @ingroup Network */ - const unsigned int FFW_API stringToIpAddress(std::string address); + unsigned int FFW_API stringToIpAddress(const std::string& address); /*! @memberof ffw @ingroup Network */ - const std::string FFW_API ipAddressToString(unsigned int address); + std::string FFW_API ipAddressToString(unsigned int address); /*! @memberof ffw @ingroup Network @@ -49,6 +49,6 @@ namespace ffw { @memberof ffw @ingroup Network */ - const std::string FFW_API getWsaErrorStr(int Error); + std::string FFW_API getWsaErrorStr(int Error); }; #endif diff --git a/third-party-libs/FragmentFramework/include/network/tcpClient.h b/dependencies/FragmentFramework/include/network/tcpClient.hpp similarity index 83% rename from third-party-libs/FragmentFramework/include/network/tcpClient.h rename to dependencies/FragmentFramework/include/network/tcpClient.hpp index 8965971..8c6beb9 100644 --- a/third-party-libs/FragmentFramework/include/network/tcpClient.h +++ b/dependencies/FragmentFramework/include/network/tcpClient.hpp @@ -7,9 +7,7 @@ #ifndef FFW_TCP_CLIENT #define FFW_TCP_CLIENT -#include "../dll.h" -#include "networkUtils.h" -#include +#include "networkUtils.hpp" /*! @ingroup Network @@ -47,7 +45,7 @@ namespace ffw { @memberof tcpClient @ingroup Network */ - bool connectTo(std::string Address, unsigned short Port); + bool connectTo(const std::string& Address, unsigned short Port); /*! @memberof tcpClient @ingroup Network @@ -62,7 +60,7 @@ namespace ffw { @memberof tcpClient @ingroup Network */ - int sendMessage(std::string Message); + int sendMessage(const std::string& Message); /*! @memberof tcpClient @ingroup Network @@ -85,13 +83,8 @@ namespace ffw { void setConnectionTimeout(int Seconds); private: - bool created; - bool connected; - SOCKET socketHandle; - bool nonBlocking; - int msgBufferSize; - char* msgBuffer; - int connectionTimeoutSec; + class impl; + impl* pimpl; }; }; #endif diff --git a/third-party-libs/FragmentFramework/include/network/tcpServer.h b/dependencies/FragmentFramework/include/network/tcpServer.hpp similarity index 83% rename from third-party-libs/FragmentFramework/include/network/tcpServer.h rename to dependencies/FragmentFramework/include/network/tcpServer.hpp index d8922de..5f20134 100644 --- a/third-party-libs/FragmentFramework/include/network/tcpServer.h +++ b/dependencies/FragmentFramework/include/network/tcpServer.hpp @@ -7,9 +7,7 @@ #ifndef FFW_TCP_LISTENER #define FFW_TCP_LISTENER -#include "../dll.h" -#include "networkUtils.h" -#include +#include "networkUtils.hpp" /*! @ingroup Network @@ -67,12 +65,12 @@ namespace ffw { @memberof tcpServer @ingroup Network */ - int sendMessage(SOCKET Client, std::string Message); + int sendMessage(SOCKET Client, const std::string& Message); /*! @memberof tcpServer @ingroup Network */ - int sendMessageRaw(SOCKET Client, char* Buffer, size_t BufferSize); + int sendMessageRaw(SOCKET Client, const char* Buffer, size_t BufferSize); /*! @memberof tcpServer @ingroup Network @@ -90,13 +88,8 @@ namespace ffw { void setMaximumConnections(int Max); private: - bool created; - bool listening; - SOCKET socketHandle; - bool nonBlocking; - int msgBufferSize; - char* msgBuffer; - int maximumConnections; + class impl; + impl* pimpl; }; }; #endif diff --git a/third-party-libs/FragmentFramework/include/network/udpListener.h b/dependencies/FragmentFramework/include/network/udpListener.hpp similarity index 85% rename from third-party-libs/FragmentFramework/include/network/udpListener.h rename to dependencies/FragmentFramework/include/network/udpListener.hpp index 4bf3954..d46441c 100644 --- a/third-party-libs/FragmentFramework/include/network/udpListener.h +++ b/dependencies/FragmentFramework/include/network/udpListener.hpp @@ -7,9 +7,7 @@ #ifndef FFW_UDP_LISTENER #define FFW_UDP_LISTENER -#include "../dll.h" -#include "networkUtils.h" -#include +#include "networkUtils.hpp" /*! @ingroup Network @@ -65,13 +63,8 @@ namespace ffw { int getMessageRaw(char* Buffer, size_t Length, int* Address); private: - bool created; - bool listening; - SOCKET socketHandle; - sockaddr_in senderAddress; - bool nonBlocking; - char* msgBuffer; - int msgBufferLength; + class impl; + impl* pimpl; }; }; #endif diff --git a/third-party-libs/FragmentFramework/include/network/udpSender.h b/dependencies/FragmentFramework/include/network/udpSender.hpp similarity index 78% rename from third-party-libs/FragmentFramework/include/network/udpSender.h rename to dependencies/FragmentFramework/include/network/udpSender.hpp index 2724981..34e4a85 100644 --- a/third-party-libs/FragmentFramework/include/network/udpSender.h +++ b/dependencies/FragmentFramework/include/network/udpSender.hpp @@ -7,9 +7,7 @@ #ifndef FFW_UDP_SENDER #define FFW_UDP_SENDER -#include "../dll.h" -#include "networkUtils.h" -#include +#include "networkUtils.hpp" /*! @ingroup Network @@ -47,7 +45,7 @@ namespace ffw { @memberof udpSender @ingroup Network */ - bool connectTo(std::string Address, unsigned short Port); + bool connectTo(const std::string& Address, unsigned short Port); /*! @memberof udpSender @ingroup Network @@ -62,19 +60,16 @@ namespace ffw { @memberof udpSender @ingroup Network */ - int sendMessage(std::string Message); + int sendMessage(const std::string& Message); /*! @memberof udpSender @ingroup Network */ - int sendMessageRaw(char* Buffer, unsigned int Length); + int sendMessageRaw(char* Buffer, size_t Length); private: - bool created; - bool connected; - SOCKET socketHandle; - sockaddr_in listenerAddress; - bool nonBlocking; + class impl; + impl* pimpl; }; }; #endif diff --git a/dependencies/FragmentFramework/include/render/appRenderWindow.hpp b/dependencies/FragmentFramework/include/render/appRenderWindow.hpp new file mode 100644 index 0000000..1d0fd1b --- /dev/null +++ b/dependencies/FragmentFramework/include/render/appRenderWindow.hpp @@ -0,0 +1,89 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_APP_RENDER_WINDOW +#define FFW_APP_RENDER_WINDOW + +#include "../config.h" +#include "renderContext.hpp" +#include "../math/math.h" + +/*! + @ingroup Core +*/ +namespace ffw { + struct FFW_API appRenderWindowArgs{ + ffw::vec2i pos = ffw::vec2i(-1, -1); + ffw::vec2i size = ffw::vec2i(400, 400); + std::string title; + bool resizable = true; + bool border = true; + bool maximize = true; + bool floating = false; + bool focused = true; + bool visible = true; + int samples = 0; + ffw::monitor* monitor = NULL; + }; + /*! + @memberof ffw + @ingroup Core + */ + class FFW_API appRenderWindow: public renderContext { + public: + appRenderWindow(); + virtual ~appRenderWindow(); + + void setPos(int PosX, int PosY); + void setSize(int Width, int Height); + ffw::vec2i getPos() const; + ffw::vec2i getSize() const; + bool create(const appRenderWindowArgs& Args, appRenderWindow* Other); + void destroy(); + void update(); + bool isInitialized() const; + bool runSetup(); + bool isClosed() const; + void shouldClose(); + + void setViewport(int PosX, int PosY, int Width, int Height) override; + const ffw::mat4& getViewMatrix() const override; + void getViewport(int *PosX, int *PosY, int *Width, int *Height) const override; + void* getGlextFunc(const std::string& FunctionName) const override; + bool isGlextFuncPresent(const std::string& FunctionName) const override; + void setSwapInterval(int Interval) override; + const glExtensions& getGlExtensions() const override; + const basicShaders& getBasicShaders() const override; + + // Disable copy operator and copy constructor + appRenderWindow& operator = (const appRenderWindow&) = delete; + appRenderWindow(const appRenderWindow&) = delete; + + struct windowCallback; + friend struct windowCallback; + + protected: + virtual bool setup() = 0; + virtual void render() = 0; + virtual void close() = 0; + virtual void textInputEvent(unsigned int C); + virtual void keyPressedEvent(int Key, int Mode); + virtual void mouseMovedEvent(int MouseX, int MouseY); + virtual void mouseScrollEvent(int scroll); + virtual void mouseButtonEvent(int button, int mode); + virtual void windowResizedEvent(int width, int height); + virtual void windowMovedEvent(int windowX, int windowY); + virtual void windowCloseEvent(); + virtual void windowFocusEvent(int focus); + virtual void filesDroppedEvent(std::vector FileList); + private: + bool setupContext(); + void destroyWindowData(); + class impl; + impl* pimpl; + }; +}; +#endif diff --git a/dependencies/FragmentFramework/include/render/renderContext.hpp b/dependencies/FragmentFramework/include/render/renderContext.hpp new file mode 100644 index 0000000..91ab3d3 --- /dev/null +++ b/dependencies/FragmentFramework/include/render/renderContext.hpp @@ -0,0 +1,81 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_RENDER_CONTEXT +#define FFW_RENDER_CONTEXT + +namespace ffw { + class renderContext; +}; + +#include "../config.h" +#include "../gl/monitors.hpp" +#include "../gl/extensions.hpp" +#include "../graphics/basicShaders.hpp" + +namespace ffw { + /*! + @memberof ffw + @ingroup Core + */ + bool FFW_API initGraphics(); + /*! + @memberof ffw + @ingroup Core + */ + void FFW_API terminateGraphics(); + /*! + @memberof ffw + @ingroup Core + */ + class FFW_API renderContext { + public: + renderContext(); + virtual ~renderContext(); + /*! + @memberof renderContext + @ingroup Core + */ + virtual void setViewport(int PosX, int PosY, int Width, int Height) = 0; + /*! + @memberof renderContext + @ingroup Core + */ + virtual const ffw::mat4& getViewMatrix() const = 0; + /*! + @memberof renderContext + @ingroup Core + */ + virtual void getViewport(int *PosX, int *PosY, int *Width, int *Height) const = 0; + /*! + @memberof renderContext + @ingroup Core + */ + virtual void* getGlextFunc(const std::string& FunctionName) const = 0; + /*! + @memberof renderContext + @ingroup Core + */ + virtual bool isGlextFuncPresent(const std::string& FunctionName) const = 0; + /*! + @memberof renderContext + @ingroup Core + */ + virtual void setSwapInterval(int Interval) = 0; + /*! + @memberof renderContext + @ingroup Core + */ + virtual const glExtensions& getGlExtensions() const = 0; + /*! + @memberof renderContext + @ingroup Core + */ + virtual const basicShaders& getBasicShaders() const = 0 ; + }; +} + +#endif diff --git a/dependencies/FragmentFramework/include/render/windowCallbackState.hpp b/dependencies/FragmentFramework/include/render/windowCallbackState.hpp new file mode 100644 index 0000000..744f2dc --- /dev/null +++ b/dependencies/FragmentFramework/include/render/windowCallbackState.hpp @@ -0,0 +1,23 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_WINDOW_CALLBACK_STATE +#define FFW_WINDOW_CALLBACK_STATE + +namespace ffw { + class mouse { + public: + static int pressed; + static int released; + static int left; + static int right; + static int middle; + static int xbutton1; + static int xbutton2; + }; +}; + +#endif \ No newline at end of file diff --git a/third-party-libs/FragmentFramework/include/serial/serialManager.h b/dependencies/FragmentFramework/include/serial/serialManager.hpp similarity index 87% rename from third-party-libs/FragmentFramework/include/serial/serialManager.h rename to dependencies/FragmentFramework/include/serial/serialManager.hpp index 84d9246..db309c8 100644 --- a/third-party-libs/FragmentFramework/include/serial/serialManager.h +++ b/dependencies/FragmentFramework/include/serial/serialManager.hpp @@ -7,9 +7,8 @@ #ifndef FFW_SERIAL #define FFW_SERIAL -#include "../dll.h" +#include "../config.h" #include -#include /*! @ingroup Serial @@ -42,7 +41,7 @@ namespace ffw { @memberof serialManager @ingroup Serial */ - bool sendMessage(std::string message); + bool sendMessage(const std::string& message); /*! @memberof serialManager @ingroup Serial @@ -60,10 +59,8 @@ namespace ffw { bool disconnect(); private: - HANDLE serialHandler; - COMSTAT serialStatus; - DWORD serialError; - bool connected; + class impl; + impl* pimpl; }; }; #endif diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiBitmap.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiBitmap.hpp new file mode 100644 index 0000000..56f3325 --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiBitmap.hpp @@ -0,0 +1,43 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_BITMAP +#define FFW_SYS_UI_BITMAP + +#include "../utilities/fileUtilities.hpp" + +namespace ffw{ + class uiBitmap; + + uiBitmap FFW_API createUiBitmap(unsigned char* Pixels, int Width, int Height); + uiBitmap FFW_API createUiBitmap(const std::wstring& Path, int Width, int Height); + + class FFW_API uiBitmap{ + public: + uiBitmap(); + ~uiBitmap(); + + operator bool() const; + bool isValid() const; + + uiBitmap(uiBitmap&& Other); + uiBitmap& operator = (uiBitmap&& Other); + + uiBitmap& operator = (const uiBitmap& Other) = delete; + uiBitmap(const uiBitmap& Other) = delete; + + friend class uiWidget; + friend class uiWindow; + friend class uiIcon; + friend class uiIconToggle; + friend class uiStaticImage; + friend uiBitmap FFW_API createUiBitmap(unsigned char* Pixels, int Width, int Height); + friend uiBitmap FFW_API createUiBitmap(const std::wstring& Path, int Width, int Height); + private: + void* data; + }; +}; +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiButton.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiButton.hpp new file mode 100644 index 0000000..116f12c --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiButton.hpp @@ -0,0 +1,26 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_BUTTON +#define FFW_SYS_UI_BUTTON + +#include "uiWidget.hpp" + +namespace ffw{ + class FFW_API uiButton: public uiWidget{ + public: + uiButton(void* Handle, int ID, int PosX, int PosY, int Width, int Height, const std::wstring& Label); + ~uiButton(); + + void disable() override; + void enable() override; + void setPos(int PosX, int PosY) override; + void setSize(int Width, int Height) override; + + static const size_t hash; + }; +}; +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiButtonToggle.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiButtonToggle.hpp new file mode 100644 index 0000000..e146eb7 --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiButtonToggle.hpp @@ -0,0 +1,29 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_BUTTON_TOGGLE +#define FFW_SYS_UI_BUTTON_TOGGLE + +#include "uiWidget.hpp" + +namespace ffw{ + class FFW_API uiButtonToggle: public uiWidget{ + public: + uiButtonToggle(void* Handle, int ID, int PosX, int PosY, int Width, int Height, const std::wstring& Label); + ~uiButtonToggle(); + + void disable() override; + void enable() override; + void setPos(int PosX, int PosY) override; + void setSize(int Width, int Height) override; + + bool getValue() const; + void setValue(bool Value) const; + + static const size_t hash; + }; +}; +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiCheckbox.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiCheckbox.hpp new file mode 100644 index 0000000..b453065 --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiCheckbox.hpp @@ -0,0 +1,29 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_CHECKBOX +#define FFW_SYS_UI_CHECKBOX + +#include "uiWidget.hpp" + +namespace ffw{ + class FFW_API uiCheckbox: public uiWidget{ + public: + uiCheckbox(void* Handle, int ID, int PosX, int PosY, int Width, int Height, const std::wstring& Label); + ~uiCheckbox(); + + void disable() override; + void enable() override; + void setPos(int PosX, int PosY) override; + void setSize(int Width, int Height) override; + + bool getValue() const; + void setValue(bool Value) const; + + static const size_t hash; + }; +}; +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiCombo.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiCombo.hpp new file mode 100644 index 0000000..64beadd --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiCombo.hpp @@ -0,0 +1,30 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_COMBO +#define FFW_SYS_UI_COMBO + +#include "uiWidget.hpp" + +namespace ffw{ + class FFW_API uiCombo: public uiWidget{ + public: + uiCombo(void* Handle, int ID, int PosX, int PosY, int Width, int Height); + ~uiCombo(); + + void disable() override; + void enable() override; + void setPos(int PosX, int PosY) override; + void setSize(int Width, int Height) override; + + void addItem(const std::wstring& Text) const; + int getSelected() const; + void setSelected(int Index) const; + + static const size_t hash; + }; +}; +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiFont.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiFont.hpp new file mode 100644 index 0000000..0fd385d --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiFont.hpp @@ -0,0 +1,39 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_UI_FONT +#define FFW_UI_FONT + +#include "../config.h" +#include + +namespace ffw{ + class uiFont; + + uiFont FFW_API createUiFont(const std::wstring& Name, int Size, int Weight); + + class FFW_API uiFont{ + public: + uiFont(); + ~uiFont(); + + operator bool() const; + bool isValid() const; + + uiFont(uiFont&& Other); + uiFont& operator = (uiFont&& Other); + + uiFont& operator = (const uiFont& Other) = delete; + uiFont(const uiFont& Other) = delete; + + friend class uiWidget; + friend uiFont FFW_API createUiFont(const std::wstring& Name, int Size, int Weight); + private: + void* data; + }; +}; + +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiGroup.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiGroup.hpp new file mode 100644 index 0000000..72ae485 --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiGroup.hpp @@ -0,0 +1,24 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_GROUP +#define FFW_SYS_UI_GROUP + +#include "uiWidget.hpp" + +namespace ffw{ + class FFW_API uiGroup: public uiWidget{ + public: + uiGroup(void* Handle, int ID, int PosX, int PosY, int Width, int Height, const std::wstring& Label); + ~uiGroup(); + + void setPos(int PosX, int PosY) override; + void setSize(int Width, int Height) override; + + static const size_t hash; + }; +}; +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiIcon.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiIcon.hpp new file mode 100644 index 0000000..3e9ae72 --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiIcon.hpp @@ -0,0 +1,30 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_ICON +#define FFW_SYS_UI_ICON + +#include "uiWidget.hpp" + +namespace ffw{ + class FFW_API uiIcon: public uiWidget{ + public: + uiIcon(void* Handle, int ID, int PosX, int PosY, int Width, int Height, const ffw::uiBitmap* Bitmap); + ~uiIcon(); + + void disable() override; + void enable() override; + void setPos(int PosX, int PosY) override; + void setSize(int Width, int Height) override; + void setBitmap(const ffw::uiBitmap* Bitmap); + + static const size_t hash; + + static const int bitmapIcon = 0; + static const int resourceIcon = 1; + }; +}; +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiIconToggle.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiIconToggle.hpp new file mode 100644 index 0000000..e409896 --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiIconToggle.hpp @@ -0,0 +1,33 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_ICON_TOGGLE +#define FFW_SYS_UI_ICON_TOGGLE + +#include "uiWidget.hpp" + +namespace ffw{ + class FFW_API uiIconToggle: public uiWidget{ + public: + uiIconToggle(void* Handle, int ID, int PosX, int PosY, int Width, int Height, const ffw::uiBitmap* Bitmap); + ~uiIconToggle(); + + void disable() override; + void enable() override; + void setPos(int PosX, int PosY) override; + void setSize(int Width, int Height) override; + + bool getValue() const; + void setValue(bool Value) const; + void setBitmap(const ffw::uiBitmap* Bitmap); + + static const size_t hash; + + static const int bitmapIcon = 0; + static const int resourceIcon = 1; + }; +}; +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiLabel.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiLabel.hpp new file mode 100644 index 0000000..9f826bc --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiLabel.hpp @@ -0,0 +1,30 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_LABEL +#define FFW_SYS_UI_LABEL + +#include "uiWidget.hpp" + +namespace ffw{ + class FFW_API uiLabel: public uiWidget{ + public: + uiLabel(void* Handle, int ID, int PosX, int PosY, int Width, int Height, const std::wstring& Label, const ffw::color& Color); + ~uiLabel(); + + void setPos(int PosX, int PosY) override; + void setSize(int Width, int Height) override; + + void setValue(const std::wstring& Label); + + static const size_t hash; + + friend class uiWindow; + private: + ffw::color col; + }; +}; +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiList.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiList.hpp new file mode 100644 index 0000000..076dc44 --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiList.hpp @@ -0,0 +1,33 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_LIST +#define FFW_SYS_UI_LIST + +#include "uiWidget.hpp" + +namespace ffw{ + class FFW_API uiList: public uiWidget{ + public: + uiList(void* Handle, int ID, int PosX, int PosY, int Width, int Height, int Scroll); + ~uiList(); + + void disable() override; + void enable() override; + void setPos(int PosX, int PosY) override; + void setSize(int Width, int Height) override; + + void addItem(const std::wstring& Text) const; + int getSelected() const; + void setSelected(int Index) const; + + static const size_t hash; + static const int noScroll = 0; + static const int horizontal = 1; + static const int vertical = 2; + }; +}; +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiMenu.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiMenu.hpp new file mode 100644 index 0000000..6ccde01 --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiMenu.hpp @@ -0,0 +1,21 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_MENU +#define FFW_SYS_UI_MENU + +#include "uiWidget.hpp" + +namespace ffw{ + class FFW_API uiMenu: public uiWidget{ + public: + uiMenu(void* Handle, int ID); + ~uiMenu(); + + static const size_t hash; + }; +}; +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiMenuFolder.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiMenuFolder.hpp new file mode 100644 index 0000000..490f321 --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiMenuFolder.hpp @@ -0,0 +1,26 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_MENU_FOLDER +#define FFW_SYS_UI_MENU_FOLDER + +#include "uiWidget.hpp" + +namespace ffw{ + class FFW_API uiMenuFolder: public uiWidget{ + public: + uiMenuFolder(void* Handle, int ID, const std::wstring& Label); + ~uiMenuFolder(); + + void disable() override; + void enable() override; + + static const size_t hash; + private: + void* parentMenu; + }; +}; +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiMenuItem.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiMenuItem.hpp new file mode 100644 index 0000000..984f873 --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiMenuItem.hpp @@ -0,0 +1,26 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_MENU_ITEM +#define FFW_SYS_UI_MENU_ITEM + +#include "uiWidget.hpp" + +namespace ffw{ + class FFW_API uiMenuItem: public uiWidget{ + public: + uiMenuItem(void* Handle, int ID, const std::wstring& Label); + ~uiMenuItem(); + + void disable() override; + void enable() override; + + static const size_t hash; + private: + void* parentMenu; + }; +}; +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiProgressbar.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiProgressbar.hpp new file mode 100644 index 0000000..582f6d7 --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiProgressbar.hpp @@ -0,0 +1,30 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_PROGRESSBAR +#define FFW_SYS_UI_PROGRESSBAR + +#include "uiWidget.hpp" + +namespace ffw{ + class FFW_API uiProgressbar: public uiWidget{ + public: + uiProgressbar(void* Handle, int ID, int PosX, int PosY, int Width, int Height); + ~uiProgressbar(); + + void disable() override; + void enable() override; + void setPos(int PosX, int PosY) override; + void setSize(int Width, int Height) override; + + void setValue(int Value); + + static const size_t hash; + private: + void* parentHwnd; + }; +}; +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiRadio.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiRadio.hpp new file mode 100644 index 0000000..b30ed8d --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiRadio.hpp @@ -0,0 +1,29 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_RADIO +#define FFW_SYS_UI_RADIO + +#include "uiWidget.hpp" + +namespace ffw{ + class FFW_API uiRadio: public uiWidget{ + public: + uiRadio(void* Handle, int ID, int PosX, int PosY, int Width, int Height, const std::wstring& Label); + ~uiRadio(); + + void disable() override; + void enable() override; + void setPos(int PosX, int PosY) override; + void setSize(int Width, int Height) override; + + bool getValue() const; + void setValue(bool Value) const; + + static const size_t hash; + }; +}; +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiRenderWindow.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiRenderWindow.hpp new file mode 100644 index 0000000..066ec40 --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiRenderWindow.hpp @@ -0,0 +1,74 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_RENDER_WINDOW +#define FFW_SYS_UI_RENDER_WINDOW + +#include "uiWidget.hpp" +#include "../render/renderContext.hpp" + +namespace ffw{ + class FFW_API uiRenderWindow: public uiWidget, public renderContext{ + public: + uiRenderWindow(); + virtual ~uiRenderWindow(); + + void setPos(int PosX, int PosY) override; + void setSize(int Width, int Height) override; + bool create(void* Handle, void* HandleInst, uiRenderWindow* Other, int ID, int PosX, int PosY, int Width, int Height); + void destroy(); + void update(); + bool isInitialized() const; + bool isClosed() const; + void shouldClose(); + bool runSetup(); + + void setViewport(int PosX, int PosY, int Width, int Height) override; + const ffw::mat4& getViewMatrix() const override; + void getViewport(int *PosX, int *PosY, int *Width, int *Height) const override; + void* getGlextFunc(const std::string& FunctionName) const override; + bool isGlextFuncPresent(const std::string& FunctionName) const override; + void setSwapInterval(int Interval) override; + const glExtensions& getGlExtensions() const override; + const basicShaders& getBasicShaders() const override; + + static const size_t hash; + + class wndProcClass; + protected: + virtual bool setup() = 0; + virtual void render() = 0; + virtual void close() = 0; + + virtual void textInputEvent(unsigned int C); + virtual void keyPressedEvent(int Key, int Mode); + virtual void mouseMovedEvent(int MouseX, int MouseY); + virtual void mouseScrollEvent(int scroll); + virtual void mouseButtonEvent(int button, int mode); + virtual void windowResizedEvent(int width, int height); + virtual void windowMovedEvent(int windowX, int windowY); + private: + bool setupContext(); + void destroyWindowData(); + class impl; + impl* pimpl; + + /*bool setupContext(); + void destroyWindowData(); + ffw::renderContextData ownContext; + ffw::renderContextData* parentContext; + void* wglContext; + void* hDC; + void* parentHInstance; + void* swapIntervalFunc; + bool setupDone; + bool initialized; + std::wstring className; + ffw::uiRenderWindow* otherWindow; + bool closed;*/ + }; +}; +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiScrollbar.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiScrollbar.hpp new file mode 100644 index 0000000..c9856b8 --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiScrollbar.hpp @@ -0,0 +1,38 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_SCROLLBAR +#define FFW_SYS_UI_SCROLLBAR + +#include "uiWidget.hpp" + +namespace ffw{ + class FFW_API uiScrollbar: public uiWidget{ + public: + uiScrollbar(void* Handle, int ID, int PosX, int PosY, int Width, int Height, int Style); + ~uiScrollbar(); + + void disable() override; + void enable() override; + void setPos(int PosX, int PosY) override; + void setSize(int Width, int Height) override; + + void setValue(int Value); + void setRange(int Min, int Max); + void setStep(int Step); + int getValue() const; + + static const int horizontal = 0; + static const int vertical = 1; + + static const size_t hash; + + friend class uiWindow; + private: + int step; + }; +}; +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiSlider.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiSlider.hpp new file mode 100644 index 0000000..499e144 --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiSlider.hpp @@ -0,0 +1,31 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_SLIDER +#define FFW_SYS_UI_SLIDER + +#include "uiWidget.hpp" + +namespace ffw{ + class FFW_API uiSlider: public uiWidget{ + public: + uiSlider(void* Handle, int ID, int PosX, int PosY, int Width, int Height); + ~uiSlider(); + + void disable() override; + void enable() override; + void setPos(int PosX, int PosY) override; + void setSize(int Width, int Height) override; + + void setRange(int Min, int Max) const; + void setStep(int Step) const; + void setValue(int Value) const; + int getValue() const; + + static const size_t hash; + }; +}; +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiStaticImage.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiStaticImage.hpp new file mode 100644 index 0000000..b2a0ff3 --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiStaticImage.hpp @@ -0,0 +1,27 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_STATIC_IMAGE +#define FFW_SYS_UI_STATIC_IMAGE + +#include "uiWidget.hpp" + +namespace ffw{ + class FFW_API uiStaticImage: public uiWidget{ + public: + uiStaticImage(void* Handle, int ID, int PosX, int PosY, int Width, int Height, const ffw::uiBitmap* Bitmap); + ~uiStaticImage(); + + void setPos(int PosX, int PosY) override; + void setSize(int Width, int Height) override; + void setBitmap(const ffw::uiBitmap* Bitmap); + + static const size_t hash; + private: + ffw::uiBitmap bmp; + }; +}; +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiStepper.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiStepper.hpp new file mode 100644 index 0000000..17c984e --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiStepper.hpp @@ -0,0 +1,30 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_STEPPER +#define FFW_SYS_UI_STEPPER + +#include "uiWidget.hpp" + +namespace ffw{ + class FFW_API uiStepper: public uiWidget{ + public: + uiStepper(void* Handle, int ID, int PosX, int PosY, int Width, int Height); + ~uiStepper(); + + void disable() override; + void enable() override; + void setPos(int PosX, int PosY) override; + void setSize(int Width, int Height) override; + + void setRange(int Min, int Max) const; + void setValue(int Value) const; + int getValue() const; + + static const size_t hash; + }; +}; +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiTextArea.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiTextArea.hpp new file mode 100644 index 0000000..abbb307 --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiTextArea.hpp @@ -0,0 +1,30 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_TEXT_AREA +#define FFW_SYS_UI_TEXT_AREA + +#include "uiWidget.hpp" + +namespace ffw{ + class FFW_API uiTextArea: public uiWidget{ + public: + uiTextArea(void* Handle, int ID, int PosX, int PosY, int Width, int Height, const std::wstring& Label, bool HScroll, bool VScroll); + ~uiTextArea(); + + void disable() override; + void enable() override; + void setPos(int PosX, int PosY) override; + void setSize(int Width, int Height) override; + + void setValue(const std::wstring& Value) const; + void setLimit(size_t Limit) const; + std::wstring getValue() const; + int getTextLength() const; + static const size_t hash; + }; +}; +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiTextInput.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiTextInput.hpp new file mode 100644 index 0000000..585df50 --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiTextInput.hpp @@ -0,0 +1,31 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_TEXT_INPUT +#define FFW_SYS_UI_TEXT_INPUT + +#include "uiWidget.hpp" + +namespace ffw{ + class FFW_API uiTextInput: public uiWidget{ + public: + uiTextInput(void* Handle, int ID, int PosX, int PosY, int Width, int Height, const std::wstring& Label); + ~uiTextInput(); + + void disable() override; + void enable() override; + void setPos(int PosX, int PosY) override; + void setSize(int Width, int Height) override; + + void setValue(const std::wstring& Value) const; + void setLimit(size_t Limit) const; + std::wstring getValue() const; + int getTextLength() const; + + static const size_t hash; + }; +}; +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiWidget.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiWidget.hpp new file mode 100644 index 0000000..6493793 --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiWidget.hpp @@ -0,0 +1,54 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_WIDGET +#define FFW_SYS_UI_WIDGET + +#include "../config.h" +#include + +#include "uiFont.hpp" +#include "uiBitmap.hpp" + +namespace ffw{ + class uiWidget; +}; + +#include "../math/math.h" + +namespace ffw{ + class FFW_API uiWidget{ + public: + uiWidget(size_t ID); + ~uiWidget(); + + void setFont(const ffw::uiFont* Font); + + void hide(); + void show(); + virtual void enable(); + virtual void disable(); + virtual void setPos(int PosX, int PosY); + virtual void setSize(int Width, int Height); + const ffw::vec2i& getPos() const; + const ffw::vec2i& getSize() const; + + friend class uiWindow; + + // Can not be moved nor copied + uiWidget(uiWidget&& Other) = delete; + uiWidget(const uiWidget& Other) = delete; + uiWidget& operator = (uiWidget&& Other) = delete; + uiWidget& operator = (const uiWidget& Other) = delete; + protected: + void* hwnd; + int id; + + ffw::vec2i size; + ffw::vec2i pos; + }; +}; +#endif \ No newline at end of file diff --git a/dependencies/FragmentFramework/include/systemUserInterface/uiWindow.hpp b/dependencies/FragmentFramework/include/systemUserInterface/uiWindow.hpp new file mode 100644 index 0000000..6cbd406 --- /dev/null +++ b/dependencies/FragmentFramework/include/systemUserInterface/uiWindow.hpp @@ -0,0 +1,138 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_SYS_UI_WINDOW +#define FFW_SYS_UI_WINDOW + +#include "../config.h" +#include "../math/math.h" +#include + +#include "uiButton.hpp" +#include "uiButtonToggle.hpp" +#include "uiCombo.hpp" +#include "uiGroup.hpp" +#include "uiCheckbox.hpp" +#include "uiIcon.hpp" +#include "uiIconToggle.hpp" +#include "uiLabel.hpp" +#include "uiList.hpp" +#include "uiProgressbar.hpp" +#include "uiRadio.hpp" +#include "uiScrollbar.hpp" +#include "uiSlider.hpp" +#include "uiStaticImage.hpp" +#include "uiStepper.hpp" +#include "uiTextArea.hpp" +#include "uiTextInput.hpp" +#include "uiMenu.hpp" +#include "uiMenuFolder.hpp" +#include "uiMenuItem.hpp" +#include "uiRenderWindow.hpp" + +namespace ffw{ + struct FFW_API uiWindowArgs { + ffw::vec2i pos = ffw::vec2i(-1, -1); + ffw::vec2i size = ffw::vec2i(400, 400); + std::wstring title = L"Title"; + bool resizable = true; + bool border = true; + bool maximize = true; + bool minimize = true; + bool closeable = true; + bool customBcgColor = false; + ffw::color bcgColor; + }; + + class uiWindow; + + bool FFW_API showModal(const uiWindow* Window, const std::wstring& Title, const std::wstring& Message, bool Cancel = false); + bool FFW_API showModalError(const uiWindow* Window, const std::wstring& Title, const std::wstring& Message, bool Cancel = false); + bool FFW_API showModalWarning(const uiWindow* Window, const std::wstring& Title, const std::wstring& Message, bool Cancel = false); + bool FFW_API showModalInfo(const uiWindow* Window, const std::wstring& Title, const std::wstring& Message, bool Cancel = false); + + class FFW_API uiWindow{ + public: + uiWindow(); + uiWindow(uiWindow&& Other); + virtual ~uiWindow(); + + bool create(const uiWindowArgs& Info); + void update(); + void destroy(); + void shouldClose(); + bool isClosed() const; + void hide(); + void show(); + void minimize(); + void maximize(); + void restore(); + + bool isInitialized() const; + + void setWindowSize(int Width, int Height); + void setSize(int Width, int Height); + void setPos(int PosX, int PosY); + ffw::vec2i getWindowSize() const; + ffw::vec2i getSize() const; + ffw::vec2i getPos() const; + + friend bool FFW_API showModal(const uiWindow* Window, const std::wstring& Title, const std::wstring& Message, bool Cancel); + friend bool FFW_API showModalError(const uiWindow* Window, const std::wstring& Title, const std::wstring& Message, bool Cancel); + friend bool FFW_API showModalWarning(const uiWindow* Window, const std::wstring& Title, const std::wstring& Message, bool Cancel); + friend bool FFW_API showModalInfo(const uiWindow* Window, const std::wstring& Title, const std::wstring& Message, bool Cancel); + + protected: + virtual void setup() = 0; + virtual void windowCloseEvent() = 0; + virtual void widgetEvent(const ffw::uiWidget* Widget) = 0; + virtual void windowPosEvent(short PosX, short PosY) = 0; + virtual void windowSizeEvent(short Width, short Height) = 0; + bool createWindow(); + + void setDefaultFont(const ffw::uiFont* Font); + uiButton* addButton(int PosX, int PosY, int Width, int Height, const std::wstring& Label); + uiButtonToggle* addButtonToggle(int PosX, int PosY, int Width, int Height, const std::wstring& Label); + uiCombo* addCombo(int PosX, int PosY, int Width, int Height); + uiGroup* addGroup(int PosX, int PosY, int Width, int Height, const std::wstring& Label); + uiCheckbox* addCheckbox(int PosX, int PosY, int Width, int Height, const std::wstring& Label); + uiIcon* addIcon(int PosX, int PosY, int Width, int Height, const ffw::uiBitmap* Bitmap); + uiIconToggle* addIconToggle(int PosX, int PosY, int Width, int Height, const ffw::uiBitmap* Bitmap); + uiLabel* addLabel(int PosX, int PosY, int Width, int Height, const std::wstring& Label, const ffw::color& Color = ffw::color(0.0f)); + uiList* addList(int PosX, int PosY, int Width, int Height, int Scroll); + uiProgressbar* addProgressbar(int PosX, int PosY, int Width, int Height); + uiRadio* addRadio(int PosX, int PosY, int Width, int Height, const std::wstring& Label); + uiScrollbar* addScrollbar(int PosX, int PosY, int Width, int Height, int Style); + uiSlider* addSlider(int PosX, int PosY, int Width, int Height); + uiStaticImage* addStaticImage(int PosX, int PosY, int Width, int Height, const ffw::uiBitmap* Bitmap); + uiStepper* addStepper(int PosX, int PosY, int Width, int Height); + uiTextArea* addTextArea(int PosX, int PosY, int Width, int Height, const std::wstring& Label, bool HScroll, bool VScroll); + uiTextInput* addTextInput(int PosX, int PosY, int Width, int Height, const std::wstring& Label); + bool addRenderWindow(uiRenderWindow* Widget, int PosX, int PosY, int Width, int Height, uiRenderWindow* Other = NULL); + bool remove(uiWidget* Widget); + + uiMenu* addMenu(); + uiMenuItem* addMenuItem(const uiMenu* Menu, const std::wstring& Label); + uiMenuFolder* addMenuFolder(const uiMenu* Menu, const std::wstring& Label); + uiMenuItem* addMenuItem(const uiMenuFolder* Menu, const std::wstring& Label); + uiMenuFolder* addMenuFolder(const uiMenuFolder* Menu, const std::wstring& Label); + void showMenu(const uiMenu* Menu); + + /*! + @memberof imageLoader + @ingroup Utilities + */ + uiWindow& operator = (uiWindow&& Other); + // Copy constructor is not allowed + uiWindow(const uiWindow& Other) = delete; + // Copy assigment is not allowed + uiWindow& operator = (const uiWindow& Other) = delete; + private: + class impl; + impl* pimpl; + }; +}; +#endif \ No newline at end of file diff --git a/third-party-libs/FragmentFramework/include/systemUtils/directory.h b/dependencies/FragmentFramework/include/systemUtils/directory.hpp similarity index 95% rename from third-party-libs/FragmentFramework/include/systemUtils/directory.h rename to dependencies/FragmentFramework/include/systemUtils/directory.hpp index 8066c73..a6fc7b6 100644 --- a/third-party-libs/FragmentFramework/include/systemUtils/directory.h +++ b/dependencies/FragmentFramework/include/systemUtils/directory.hpp @@ -7,8 +7,7 @@ #ifndef FFW_DIR #define FFW_DIR -#include "../dll.h" -#include "../math/math.h" +#include "../config.h" #include #include diff --git a/third-party-libs/FragmentFramework/include/systemUtils/win32SysUtils.h b/dependencies/FragmentFramework/include/systemUtils/win32SysUtils.hpp similarity index 91% rename from third-party-libs/FragmentFramework/include/systemUtils/win32SysUtils.h rename to dependencies/FragmentFramework/include/systemUtils/win32SysUtils.hpp index 7937634..3588cad 100644 --- a/third-party-libs/FragmentFramework/include/systemUtils/win32SysUtils.h +++ b/dependencies/FragmentFramework/include/systemUtils/win32SysUtils.hpp @@ -7,7 +7,7 @@ #ifndef FFW_SYS_UTILS #define FFW_SYS_UTILS -#include "../dll.h" +#include "../config.h" #include /*! @@ -62,11 +62,6 @@ namespace ffw { /*! @memberof ffw @ingroup System - */ - bool FFW_API captureScreenToFile(const std::string& path); - /*! - @memberof ffw - @ingroup System */ std::string FFW_API getExecutablePath(); }; diff --git a/third-party-libs/FragmentFramework/include/utilities/file.h b/dependencies/FragmentFramework/include/utilities/file.hpp similarity index 92% rename from third-party-libs/FragmentFramework/include/utilities/file.h rename to dependencies/FragmentFramework/include/utilities/file.hpp index 978cc10..bed52cd 100644 --- a/third-party-libs/FragmentFramework/include/utilities/file.h +++ b/dependencies/FragmentFramework/include/utilities/file.hpp @@ -7,7 +7,7 @@ #ifndef FFW_FILE #define FFW_FILE -#include "../dll.h" +#include "../config.h" #include #include @@ -88,11 +88,21 @@ namespace ffw{ @ingroup Utilities */ bool gotoLine(unsigned int Num); + /*! + @memberof file + @ingroup Utilities + */ + bool gotoLineOffset(unsigned int Num); /*! @memberof file @ingroup Utilities */ bool gotoEnd(); + /*! + @memberof file + @ingroup Utilities + */ + bool reset(); /*! @memberof file @ingroup Utilities diff --git a/third-party-libs/FragmentFramework/include/utilities/fileUtilities.h b/dependencies/FragmentFramework/include/utilities/fileUtilities.hpp similarity index 91% rename from third-party-libs/FragmentFramework/include/utilities/fileUtilities.h rename to dependencies/FragmentFramework/include/utilities/fileUtilities.hpp index d0127c2..15efe88 100644 --- a/third-party-libs/FragmentFramework/include/utilities/fileUtilities.h +++ b/dependencies/FragmentFramework/include/utilities/fileUtilities.hpp @@ -7,12 +7,8 @@ #ifndef FFW_FILE_UTILITIES #define FFW_FILE_UTILITIES -#include "../dll.h" -#include "../math/stringMath.h" -#include "../math/math.h" - -#include -#include +#include "../config.h" +#include /*! @ingroup Utilities diff --git a/third-party-libs/FragmentFramework/include/utilities/logger.h b/dependencies/FragmentFramework/include/utilities/logger.hpp similarity index 95% rename from third-party-libs/FragmentFramework/include/utilities/logger.h rename to dependencies/FragmentFramework/include/utilities/logger.hpp index 9dd80a8..d9e82f4 100644 --- a/third-party-libs/FragmentFramework/include/utilities/logger.h +++ b/dependencies/FragmentFramework/include/utilities/logger.hpp @@ -7,7 +7,7 @@ #ifndef FFW_LOGGER #define FFW_LOGGER -#include "../dll.h" +#include "../config.h" #include #include @@ -26,7 +26,7 @@ namespace ffw{ @ingroup Utilities @static */ - static void initLogger(std::string Path); + static void initLogger(const std::string& Path); /*! @memberof logger @ingroup Utilities @@ -89,7 +89,7 @@ namespace ffw{ virtual ~logger(); private: - int type; + int type; std::ostringstream os; void addLine(); std::string getTime(); diff --git a/dependencies/FragmentFramework/include/utilities/mutex.hpp b/dependencies/FragmentFramework/include/utilities/mutex.hpp new file mode 100644 index 0000000..2257e08 --- /dev/null +++ b/dependencies/FragmentFramework/include/utilities/mutex.hpp @@ -0,0 +1,37 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_MUTEX +#define FFW_MUTEX + +#include "../config.h" + +// Compile for Visual Studio +#if defined(_USING_MSVC) +#include +#elif defined(_USING_MINGW) +#include +#endif + +namespace ffw{ + class FFW_API mutex { + public: + mutex(); + ~mutex(); + bool lock(); + bool tryLock(); + bool unlock(); + + private: + #if defined(_USING_MSVC) + std::mutex mut; + #elif defined(_USING_MINGW) + pthread_mutex_t mut; + #endif + }; +}; + +#endif diff --git a/third-party-libs/FragmentFramework/include/utilities/serialization.h b/dependencies/FragmentFramework/include/utilities/serialization.hpp similarity index 97% rename from third-party-libs/FragmentFramework/include/utilities/serialization.h rename to dependencies/FragmentFramework/include/utilities/serialization.hpp index 3510581..33df2e9 100644 --- a/third-party-libs/FragmentFramework/include/utilities/serialization.h +++ b/dependencies/FragmentFramework/include/utilities/serialization.hpp @@ -7,7 +7,7 @@ #ifndef FFW_SERIALIZATION #define FFW_SERIALIZATION -#include "../dll.h" +#include "../config.h" #include #include #include @@ -62,7 +62,7 @@ namespace ffw{ }; private: - std::vector varList; + std::vector varList; protected: /*! diff --git a/dependencies/FragmentFramework/include/utilities/thread.hpp b/dependencies/FragmentFramework/include/utilities/thread.hpp new file mode 100644 index 0000000..ced9cae --- /dev/null +++ b/dependencies/FragmentFramework/include/utilities/thread.hpp @@ -0,0 +1,44 @@ +/* +* This file is part of FragmentFramework framework. +* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef FFW_THREAD +#define FFW_THREAD + +#include "../config.h" + +// Compile for Visual Studio +#if defined(_USING_MSVC) +#include +#elif defined(_USING_MINGW) +#include +#endif +#include + +namespace ffw{ + class FFW_API thread{ + public: + thread(); + virtual ~thread(); + bool start(void* DataPtr); + bool join(); + bool join(void** ReturnValue); + void bindFunction(void* (*Func)(void*)); + void bindFunction(std::function Func); + + private: + static void *internalThreadFunc(void* This); + void* (*threadFunc)(void*); + std::function threadFuncMem; + #if defined(_USING_MSVC) + std::thread* sthread; + #elif defined(_USING_MINGW) + pthread_t pthread; + #endif + void* dataPtr; + }; +}; + +#endif diff --git a/third-party-libs/FragmentFramework/include/utilities/timer.h b/dependencies/FragmentFramework/include/utilities/timer.hpp similarity index 83% rename from third-party-libs/FragmentFramework/include/utilities/timer.h rename to dependencies/FragmentFramework/include/utilities/timer.hpp index cca5b93..b7e14e1 100644 --- a/third-party-libs/FragmentFramework/include/utilities/timer.h +++ b/dependencies/FragmentFramework/include/utilities/timer.hpp @@ -7,8 +7,7 @@ #ifndef FFW_TIMER #define FFW_TIMER -#include "../dll.h" -#include "windows.h" +#include "../config.h" #include /*! @@ -45,17 +44,14 @@ namespace ffw{ @memberof timer @ingroup Utilities */ - uint64_t getTimeMilli(); + unsigned long long getTimeMilli(); /*! @memberof timer @ingroup Utilities */ - uint64_t getTimeMicro(); + unsigned long long getTimeMicro(); private: - /*LARGE_INTEGER beginTime; - LARGE_INTEGER endTime; - LARGE_INTEGER frequency;*/ std::chrono::steady_clock::time_point t1; std::chrono::steady_clock::time_point t2; }; diff --git a/third-party-libs/FragmentFramework/include/utilities/usleep.h b/dependencies/FragmentFramework/include/utilities/usleep.hpp similarity index 80% rename from third-party-libs/FragmentFramework/include/utilities/usleep.h rename to dependencies/FragmentFramework/include/utilities/usleep.hpp index 8e2fc50..44f9c1d 100644 --- a/third-party-libs/FragmentFramework/include/utilities/usleep.h +++ b/dependencies/FragmentFramework/include/utilities/usleep.hpp @@ -7,8 +7,7 @@ #ifndef FFW_USLEEP #define FFW_USLEEP -#include "../dll.h" -#include +#include "../config.h" /*! @ingroup Utilities @@ -18,6 +17,6 @@ namespace ffw{ @memberof ffw @ingroup Utilities */ - void FFW_API usleep(int64_t Micros); + void FFW_API usleep(unsigned long long Micros); }; #endif diff --git a/dependencies/FragmentFramework/lib/mingw/FragmentFramework-debug.dll b/dependencies/FragmentFramework/lib/mingw/FragmentFramework-debug.dll new file mode 100644 index 0000000..8368741 Binary files /dev/null and b/dependencies/FragmentFramework/lib/mingw/FragmentFramework-debug.dll differ diff --git a/dependencies/FragmentFramework/lib/mingw/FragmentFramework.dll b/dependencies/FragmentFramework/lib/mingw/FragmentFramework.dll new file mode 100644 index 0000000..b6b176f Binary files /dev/null and b/dependencies/FragmentFramework/lib/mingw/FragmentFramework.dll differ diff --git a/dependencies/FragmentFramework/lib/mingw/libFragmentFramework-debug.dll.a b/dependencies/FragmentFramework/lib/mingw/libFragmentFramework-debug.dll.a new file mode 100644 index 0000000..69bf812 Binary files /dev/null and b/dependencies/FragmentFramework/lib/mingw/libFragmentFramework-debug.dll.a differ diff --git a/dependencies/FragmentFramework/lib/mingw/libFragmentFramework.dll.a b/dependencies/FragmentFramework/lib/mingw/libFragmentFramework.dll.a new file mode 100644 index 0000000..a88f467 Binary files /dev/null and b/dependencies/FragmentFramework/lib/mingw/libFragmentFramework.dll.a differ diff --git a/dependencies/FragmentFramework/lib/msvc/FragmentFramework-debug.dll b/dependencies/FragmentFramework/lib/msvc/FragmentFramework-debug.dll new file mode 100644 index 0000000..562166e Binary files /dev/null and b/dependencies/FragmentFramework/lib/msvc/FragmentFramework-debug.dll differ diff --git a/dependencies/FragmentFramework/lib/msvc/FragmentFramework-debug.exp b/dependencies/FragmentFramework/lib/msvc/FragmentFramework-debug.exp new file mode 100644 index 0000000..a08e440 Binary files /dev/null and b/dependencies/FragmentFramework/lib/msvc/FragmentFramework-debug.exp differ diff --git a/dependencies/FragmentFramework/lib/msvc/FragmentFramework-debug.lib b/dependencies/FragmentFramework/lib/msvc/FragmentFramework-debug.lib new file mode 100644 index 0000000..3eb0b9f Binary files /dev/null and b/dependencies/FragmentFramework/lib/msvc/FragmentFramework-debug.lib differ diff --git a/dependencies/FragmentFramework/lib/msvc/FragmentFramework-debug.pdb b/dependencies/FragmentFramework/lib/msvc/FragmentFramework-debug.pdb new file mode 100644 index 0000000..59a8562 Binary files /dev/null and b/dependencies/FragmentFramework/lib/msvc/FragmentFramework-debug.pdb differ diff --git a/dependencies/FragmentFramework/lib/msvc/FragmentFramework.dll b/dependencies/FragmentFramework/lib/msvc/FragmentFramework.dll new file mode 100644 index 0000000..1a04e8a Binary files /dev/null and b/dependencies/FragmentFramework/lib/msvc/FragmentFramework.dll differ diff --git a/dependencies/FragmentFramework/lib/msvc/FragmentFramework.exp b/dependencies/FragmentFramework/lib/msvc/FragmentFramework.exp new file mode 100644 index 0000000..cd8a6c5 Binary files /dev/null and b/dependencies/FragmentFramework/lib/msvc/FragmentFramework.exp differ diff --git a/dependencies/FragmentFramework/lib/msvc/FragmentFramework.lib b/dependencies/FragmentFramework/lib/msvc/FragmentFramework.lib new file mode 100644 index 0000000..652e8a0 Binary files /dev/null and b/dependencies/FragmentFramework/lib/msvc/FragmentFramework.lib differ diff --git a/dependencies/FragmentFramework/lib/msvc/FragmentFramework.pdb b/dependencies/FragmentFramework/lib/msvc/FragmentFramework.pdb new file mode 100644 index 0000000..e5473f6 Binary files /dev/null and b/dependencies/FragmentFramework/lib/msvc/FragmentFramework.pdb differ diff --git a/dependencies/pthreads/include/pthread.h b/dependencies/pthreads/include/pthread.h new file mode 100644 index 0000000..b4072f7 --- /dev/null +++ b/dependencies/pthreads/include/pthread.h @@ -0,0 +1,1368 @@ +/* This is an implementation of the threads API of POSIX 1003.1-2001. + * + * -------------------------------------------------------------------------- + * + * Pthreads-win32 - POSIX Threads Library for Win32 + * Copyright(C) 1998 John E. Bossom + * Copyright(C) 1999,2005 Pthreads-win32 contributors + * + * Contact Email: rpj@callisto.canberra.edu.au + * + * The current list of contributors is contained + * in the file CONTRIBUTORS included with the source + * code distribution. The list can also be seen at the + * following World Wide Web location: + * http://sources.redhat.com/pthreads-win32/contributors.html + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library in the file COPYING.LIB; + * if not, write to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#if !defined( PTHREAD_H ) +#define PTHREAD_H + +/* + * See the README file for an explanation of the pthreads-win32 version + * numbering scheme and how the DLL is named etc. + */ +#define PTW32_VERSION 2,9,1,0 +#define PTW32_VERSION_STRING "2, 9, 1, 0\0" + +/* There are three implementations of cancel cleanup. + * Note that pthread.h is included in both application + * compilation units and also internally for the library. + * The code here and within the library aims to work + * for all reasonable combinations of environments. + * + * The three implementations are: + * + * WIN32 SEH + * C + * C++ + * + * Please note that exiting a push/pop block via + * "return", "exit", "break", or "continue" will + * lead to different behaviour amongst applications + * depending upon whether the library was built + * using SEH, C++, or C. For example, a library built + * with SEH will call the cleanup routine, while both + * C++ and C built versions will not. + */ + +/* + * Define defaults for cleanup code. + * Note: Unless the build explicitly defines one of the following, then + * we default to standard C style cleanup. This style uses setjmp/longjmp + * in the cancelation and thread exit implementations and therefore won't + * do stack unwinding if linked to applications that have it (e.g. + * C++ apps). This is currently consistent with most/all commercial Unix + * POSIX threads implementations. + */ +#if !defined( __CLEANUP_SEH ) && !defined( __CLEANUP_CXX ) && !defined( __CLEANUP_C ) +# define __CLEANUP_C +#endif + +#if defined( __CLEANUP_SEH ) && ( !defined( _MSC_VER ) && !defined(PTW32_RC_MSC)) +#error ERROR [__FILE__, line __LINE__]: SEH is not supported for this compiler. +#endif + +/* + * Stop here if we are being included by the resource compiler. + */ +#if !defined(RC_INVOKED) + +#undef PTW32_LEVEL + +#if defined(_POSIX_SOURCE) +#define PTW32_LEVEL 0 +/* Early POSIX */ +#endif + +#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309 +#undef PTW32_LEVEL +#define PTW32_LEVEL 1 +/* Include 1b, 1c and 1d */ +#endif + +#if defined(INCLUDE_NP) +#undef PTW32_LEVEL +#define PTW32_LEVEL 2 +/* Include Non-Portable extensions */ +#endif + +#define PTW32_LEVEL_MAX 3 + +#if ( defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112 ) || !defined(PTW32_LEVEL) +#define PTW32_LEVEL PTW32_LEVEL_MAX +/* Include everything */ +#endif + +#if defined(_UWIN) +# define HAVE_STRUCT_TIMESPEC 1 +# define HAVE_SIGNAL_H 1 +# undef HAVE_PTW32_CONFIG_H +# pragma comment(lib, "pthread") +#endif + +/* + * ------------------------------------------------------------- + * + * + * Module: pthread.h + * + * Purpose: + * Provides an implementation of PThreads based upon the + * standard: + * + * POSIX 1003.1-2001 + * and + * The Single Unix Specification version 3 + * + * (these two are equivalent) + * + * in order to enhance code portability between Windows, + * various commercial Unix implementations, and Linux. + * + * See the ANNOUNCE file for a full list of conforming + * routines and defined constants, and a list of missing + * routines and constants not defined in this implementation. + * + * Authors: + * There have been many contributors to this library. + * The initial implementation was contributed by + * John Bossom, and several others have provided major + * sections or revisions of parts of the implementation. + * Often significant effort has been contributed to + * find and fix important bugs and other problems to + * improve the reliability of the library, which sometimes + * is not reflected in the amount of code which changed as + * result. + * As much as possible, the contributors are acknowledged + * in the ChangeLog file in the source code distribution + * where their changes are noted in detail. + * + * Contributors are listed in the CONTRIBUTORS file. + * + * As usual, all bouquets go to the contributors, and all + * brickbats go to the project maintainer. + * + * Maintainer: + * The code base for this project is coordinated and + * eventually pre-tested, packaged, and made available by + * + * Ross Johnson + * + * QA Testers: + * Ultimately, the library is tested in the real world by + * a host of competent and demanding scientists and + * engineers who report bugs and/or provide solutions + * which are then fixed or incorporated into subsequent + * versions of the library. Each time a bug is fixed, a + * test case is written to prove the fix and ensure + * that later changes to the code don't reintroduce the + * same error. The number of test cases is slowly growing + * and therefore so is the code reliability. + * + * Compliance: + * See the file ANNOUNCE for the list of implemented + * and not-implemented routines and defined options. + * Of course, these are all defined is this file as well. + * + * Web site: + * The source code and other information about this library + * are available from + * + * http://sources.redhat.com/pthreads-win32/ + * + * ------------------------------------------------------------- + */ + +/* Try to avoid including windows.h */ +#if (defined(__MINGW64__) || defined(__MINGW32__)) && defined(__cplusplus) +#define PTW32_INCLUDE_WINDOWS_H +#endif + +#if defined(PTW32_INCLUDE_WINDOWS_H) +#include +#endif + +#if defined(_MSC_VER) && _MSC_VER < 1300 || defined(__DMC__) +/* + * VC++6.0 or early compiler's header has no DWORD_PTR type. + */ +typedef unsigned long DWORD_PTR; +typedef unsigned long ULONG_PTR; +#endif +/* + * ----------------- + * autoconf switches + * ----------------- + */ + +#if defined(HAVE_PTW32_CONFIG_H) +#include "config.h" +#endif /* HAVE_PTW32_CONFIG_H */ + +#if !defined(NEED_FTIME) +#include +#else /* NEED_FTIME */ +/* use native WIN32 time API */ +#endif /* NEED_FTIME */ + +#if defined(HAVE_SIGNAL_H) +#include +#endif /* HAVE_SIGNAL_H */ + +#include + +/* + * Boolean values to make us independent of system includes. + */ +enum { + PTW32_FALSE = 0, + PTW32_TRUE = (! PTW32_FALSE) +}; + +/* + * This is a duplicate of what is in the autoconf config.h, + * which is only used when building the pthread-win32 libraries. + */ + +#if !defined(PTW32_CONFIG_H) +# if defined(WINCE) +# define NEED_ERRNO +# define NEED_SEM +# endif +# if defined(__MINGW64__) +# define HAVE_STRUCT_TIMESPEC +# define HAVE_MODE_T +# elif defined(_UWIN) || defined(__MINGW32__) +# define HAVE_MODE_T +# endif +#endif + +/* + * + */ + +#if PTW32_LEVEL >= PTW32_LEVEL_MAX +#if defined(NEED_ERRNO) +#include "need_errno.h" +#else +#include +#endif +#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ + +/* + * Several systems don't define some error numbers. + */ +#if !defined(ENOTSUP) +# define ENOTSUP 48 /* This is the value in Solaris. */ +#endif + +#if !defined(ETIMEDOUT) +# define ETIMEDOUT 10060 /* Same as WSAETIMEDOUT */ +#endif + +#if !defined(ENOSYS) +# define ENOSYS 140 /* Semi-arbitrary value */ +#endif + +#if !defined(EDEADLK) +# if defined(EDEADLOCK) +# define EDEADLK EDEADLOCK +# else +# define EDEADLK 36 /* This is the value in MSVC. */ +# endif +#endif + +/* POSIX 2008 - related to robust mutexes */ +#if !defined(EOWNERDEAD) +# define EOWNERDEAD 43 +#endif +#if !defined(ENOTRECOVERABLE) +# define ENOTRECOVERABLE 44 +#endif + +#include + +/* + * To avoid including windows.h we define only those things that we + * actually need from it. + */ +#if !defined(PTW32_INCLUDE_WINDOWS_H) +#if !defined(HANDLE) +# define PTW32__HANDLE_DEF +# define HANDLE void * +#endif +#if !defined(DWORD) +# define PTW32__DWORD_DEF +# define DWORD unsigned long +#endif +#endif + +#if !defined(HAVE_STRUCT_TIMESPEC) +#define HAVE_STRUCT_TIMESPEC +#if !defined(_TIMESPEC_DEFINED) +#define _TIMESPEC_DEFINED +struct timespec { + time_t tv_sec; + long tv_nsec; +}; +#endif /* _TIMESPEC_DEFINED */ +#endif /* HAVE_STRUCT_TIMESPEC */ + +#if !defined(SIG_BLOCK) +#define SIG_BLOCK 0 +#endif /* SIG_BLOCK */ + +#if !defined(SIG_UNBLOCK) +#define SIG_UNBLOCK 1 +#endif /* SIG_UNBLOCK */ + +#if !defined(SIG_SETMASK) +#define SIG_SETMASK 2 +#endif /* SIG_SETMASK */ + +#if defined(__cplusplus) +extern "C" +{ +#endif /* __cplusplus */ + +/* + * ------------------------------------------------------------- + * + * POSIX 1003.1-2001 Options + * ========================= + * + * Options are normally set in , which is not provided + * with pthreads-win32. + * + * For conformance with the Single Unix Specification (version 3), all of the + * options below are defined, and have a value of either -1 (not supported) + * or 200112L (supported). + * + * These options can neither be left undefined nor have a value of 0, because + * either indicates that sysconf(), which is not implemented, may be used at + * runtime to check the status of the option. + * + * _POSIX_THREADS (== 200112L) + * If == 200112L, you can use threads + * + * _POSIX_THREAD_ATTR_STACKSIZE (== 200112L) + * If == 200112L, you can control the size of a thread's + * stack + * pthread_attr_getstacksize + * pthread_attr_setstacksize + * + * _POSIX_THREAD_ATTR_STACKADDR (== -1) + * If == 200112L, you can allocate and control a thread's + * stack. If not supported, the following functions + * will return ENOSYS, indicating they are not + * supported: + * pthread_attr_getstackaddr + * pthread_attr_setstackaddr + * + * _POSIX_THREAD_PRIORITY_SCHEDULING (== -1) + * If == 200112L, you can use realtime scheduling. + * This option indicates that the behaviour of some + * implemented functions conforms to the additional TPS + * requirements in the standard. E.g. rwlocks favour + * writers over readers when threads have equal priority. + * + * _POSIX_THREAD_PRIO_INHERIT (== -1) + * If == 200112L, you can create priority inheritance + * mutexes. + * pthread_mutexattr_getprotocol + + * pthread_mutexattr_setprotocol + + * + * _POSIX_THREAD_PRIO_PROTECT (== -1) + * If == 200112L, you can create priority ceiling mutexes + * Indicates the availability of: + * pthread_mutex_getprioceiling + * pthread_mutex_setprioceiling + * pthread_mutexattr_getprioceiling + * pthread_mutexattr_getprotocol + + * pthread_mutexattr_setprioceiling + * pthread_mutexattr_setprotocol + + * + * _POSIX_THREAD_PROCESS_SHARED (== -1) + * If set, you can create mutexes and condition + * variables that can be shared with another + * process.If set, indicates the availability + * of: + * pthread_mutexattr_getpshared + * pthread_mutexattr_setpshared + * pthread_condattr_getpshared + * pthread_condattr_setpshared + * + * _POSIX_THREAD_SAFE_FUNCTIONS (== 200112L) + * If == 200112L you can use the special *_r library + * functions that provide thread-safe behaviour + * + * _POSIX_READER_WRITER_LOCKS (== 200112L) + * If == 200112L, you can use read/write locks + * + * _POSIX_SPIN_LOCKS (== 200112L) + * If == 200112L, you can use spin locks + * + * _POSIX_BARRIERS (== 200112L) + * If == 200112L, you can use barriers + * + * + These functions provide both 'inherit' and/or + * 'protect' protocol, based upon these macro + * settings. + * + * ------------------------------------------------------------- + */ + +/* + * POSIX Options + */ +#undef _POSIX_THREADS +#define _POSIX_THREADS 200809L + +#undef _POSIX_READER_WRITER_LOCKS +#define _POSIX_READER_WRITER_LOCKS 200809L + +#undef _POSIX_SPIN_LOCKS +#define _POSIX_SPIN_LOCKS 200809L + +#undef _POSIX_BARRIERS +#define _POSIX_BARRIERS 200809L + +#undef _POSIX_THREAD_SAFE_FUNCTIONS +#define _POSIX_THREAD_SAFE_FUNCTIONS 200809L + +#undef _POSIX_THREAD_ATTR_STACKSIZE +#define _POSIX_THREAD_ATTR_STACKSIZE 200809L + +/* + * The following options are not supported + */ +#undef _POSIX_THREAD_ATTR_STACKADDR +#define _POSIX_THREAD_ATTR_STACKADDR -1 + +#undef _POSIX_THREAD_PRIO_INHERIT +#define _POSIX_THREAD_PRIO_INHERIT -1 + +#undef _POSIX_THREAD_PRIO_PROTECT +#define _POSIX_THREAD_PRIO_PROTECT -1 + +/* TPS is not fully supported. */ +#undef _POSIX_THREAD_PRIORITY_SCHEDULING +#define _POSIX_THREAD_PRIORITY_SCHEDULING -1 + +#undef _POSIX_THREAD_PROCESS_SHARED +#define _POSIX_THREAD_PROCESS_SHARED -1 + + +/* + * POSIX 1003.1-2001 Limits + * =========================== + * + * These limits are normally set in , which is not provided with + * pthreads-win32. + * + * PTHREAD_DESTRUCTOR_ITERATIONS + * Maximum number of attempts to destroy + * a thread's thread-specific data on + * termination (must be at least 4) + * + * PTHREAD_KEYS_MAX + * Maximum number of thread-specific data keys + * available per process (must be at least 128) + * + * PTHREAD_STACK_MIN + * Minimum supported stack size for a thread + * + * PTHREAD_THREADS_MAX + * Maximum number of threads supported per + * process (must be at least 64). + * + * SEM_NSEMS_MAX + * The maximum number of semaphores a process can have. + * (must be at least 256) + * + * SEM_VALUE_MAX + * The maximum value a semaphore can have. + * (must be at least 32767) + * + */ +#undef _POSIX_THREAD_DESTRUCTOR_ITERATIONS +#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 + +#undef PTHREAD_DESTRUCTOR_ITERATIONS +#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS + +#undef _POSIX_THREAD_KEYS_MAX +#define _POSIX_THREAD_KEYS_MAX 128 + +#undef PTHREAD_KEYS_MAX +#define PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX + +#undef PTHREAD_STACK_MIN +#define PTHREAD_STACK_MIN 0 + +#undef _POSIX_THREAD_THREADS_MAX +#define _POSIX_THREAD_THREADS_MAX 64 + + /* Arbitrary value */ +#undef PTHREAD_THREADS_MAX +#define PTHREAD_THREADS_MAX 2019 + +#undef _POSIX_SEM_NSEMS_MAX +#define _POSIX_SEM_NSEMS_MAX 256 + + /* Arbitrary value */ +#undef SEM_NSEMS_MAX +#define SEM_NSEMS_MAX 1024 + +#undef _POSIX_SEM_VALUE_MAX +#define _POSIX_SEM_VALUE_MAX 32767 + +#undef SEM_VALUE_MAX +#define SEM_VALUE_MAX INT_MAX + + +#if defined(__GNUC__) && !defined(__declspec) +# error Please upgrade your GNU compiler to one that supports __declspec. +#endif + +/* + * When building the library, you should define PTW32_BUILD so that + * the variables/functions are exported correctly. When using the library, + * do NOT define PTW32_BUILD, and then the variables/functions will + * be imported correctly. + */ +#if !defined(PTW32_STATIC_LIB) +# if defined(PTW32_BUILD) +# define PTW32_DLLPORT __declspec (dllexport) +# else +# define PTW32_DLLPORT __declspec (dllimport) +# endif +#else +# define PTW32_DLLPORT +#endif + +/* + * The Open Watcom C/C++ compiler uses a non-standard calling convention + * that passes function args in registers unless __cdecl is explicitly specified + * in exposed function prototypes. + * + * We force all calls to cdecl even though this could slow Watcom code down + * slightly. If you know that the Watcom compiler will be used to build both + * the DLL and application, then you can probably define this as a null string. + * Remember that pthread.h (this file) is used for both the DLL and application builds. + */ +#define PTW32_CDECL __cdecl + +#if defined(_UWIN) && PTW32_LEVEL >= PTW32_LEVEL_MAX +# include +#else +/* + * Generic handle type - intended to extend uniqueness beyond + * that available with a simple pointer. It should scale for either + * IA-32 or IA-64. + */ +typedef struct { + void * p; /* Pointer to actual object */ + unsigned int x; /* Extra information - reuse count etc */ +} ptw32_handle_t; + +typedef ptw32_handle_t pthread_t; +typedef struct pthread_attr_t_ * pthread_attr_t; +typedef struct pthread_once_t_ pthread_once_t; +typedef struct pthread_key_t_ * pthread_key_t; +typedef struct pthread_mutex_t_ * pthread_mutex_t; +typedef struct pthread_mutexattr_t_ * pthread_mutexattr_t; +typedef struct pthread_cond_t_ * pthread_cond_t; +typedef struct pthread_condattr_t_ * pthread_condattr_t; +#endif +typedef struct pthread_rwlock_t_ * pthread_rwlock_t; +typedef struct pthread_rwlockattr_t_ * pthread_rwlockattr_t; +typedef struct pthread_spinlock_t_ * pthread_spinlock_t; +typedef struct pthread_barrier_t_ * pthread_barrier_t; +typedef struct pthread_barrierattr_t_ * pthread_barrierattr_t; + +/* + * ==================== + * ==================== + * POSIX Threads + * ==================== + * ==================== + */ + +enum { +/* + * pthread_attr_{get,set}detachstate + */ + PTHREAD_CREATE_JOINABLE = 0, /* Default */ + PTHREAD_CREATE_DETACHED = 1, + +/* + * pthread_attr_{get,set}inheritsched + */ + PTHREAD_INHERIT_SCHED = 0, + PTHREAD_EXPLICIT_SCHED = 1, /* Default */ + +/* + * pthread_{get,set}scope + */ + PTHREAD_SCOPE_PROCESS = 0, + PTHREAD_SCOPE_SYSTEM = 1, /* Default */ + +/* + * pthread_setcancelstate paramters + */ + PTHREAD_CANCEL_ENABLE = 0, /* Default */ + PTHREAD_CANCEL_DISABLE = 1, + +/* + * pthread_setcanceltype parameters + */ + PTHREAD_CANCEL_ASYNCHRONOUS = 0, + PTHREAD_CANCEL_DEFERRED = 1, /* Default */ + +/* + * pthread_mutexattr_{get,set}pshared + * pthread_condattr_{get,set}pshared + */ + PTHREAD_PROCESS_PRIVATE = 0, + PTHREAD_PROCESS_SHARED = 1, + +/* + * pthread_mutexattr_{get,set}robust + */ + PTHREAD_MUTEX_STALLED = 0, /* Default */ + PTHREAD_MUTEX_ROBUST = 1, + +/* + * pthread_barrier_wait + */ + PTHREAD_BARRIER_SERIAL_THREAD = -1 +}; + +/* + * ==================== + * ==================== + * Cancelation + * ==================== + * ==================== + */ +#define PTHREAD_CANCELED ((void *)(size_t) -1) + + +/* + * ==================== + * ==================== + * Once Key + * ==================== + * ==================== + */ +#define PTHREAD_ONCE_INIT { PTW32_FALSE, 0, 0, 0} + +struct pthread_once_t_ +{ + int done; /* indicates if user function has been executed */ + void * lock; + int reserved1; + int reserved2; +}; + + +/* + * ==================== + * ==================== + * Object initialisers + * ==================== + * ==================== + */ +#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t)(size_t) -1) +#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER ((pthread_mutex_t)(size_t) -2) +#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER ((pthread_mutex_t)(size_t) -3) + +/* + * Compatibility with LinuxThreads + */ +#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP PTHREAD_RECURSIVE_MUTEX_INITIALIZER +#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP PTHREAD_ERRORCHECK_MUTEX_INITIALIZER + +#define PTHREAD_COND_INITIALIZER ((pthread_cond_t)(size_t) -1) + +#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t)(size_t) -1) + +#define PTHREAD_SPINLOCK_INITIALIZER ((pthread_spinlock_t)(size_t) -1) + + +/* + * Mutex types. + */ +enum +{ + /* Compatibility with LinuxThreads */ + PTHREAD_MUTEX_FAST_NP, + PTHREAD_MUTEX_RECURSIVE_NP, + PTHREAD_MUTEX_ERRORCHECK_NP, + PTHREAD_MUTEX_TIMED_NP = PTHREAD_MUTEX_FAST_NP, + PTHREAD_MUTEX_ADAPTIVE_NP = PTHREAD_MUTEX_FAST_NP, + /* For compatibility with POSIX */ + PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_FAST_NP, + PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP, + PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP, + PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL +}; + + +typedef struct ptw32_cleanup_t ptw32_cleanup_t; + +#if defined(_MSC_VER) +/* Disable MSVC 'anachronism used' warning */ +#pragma warning( disable : 4229 ) +#endif + +typedef void (* PTW32_CDECL ptw32_cleanup_callback_t)(void *); + +#if defined(_MSC_VER) +#pragma warning( default : 4229 ) +#endif + +struct ptw32_cleanup_t +{ + ptw32_cleanup_callback_t routine; + void *arg; + struct ptw32_cleanup_t *prev; +}; + +#if defined(__CLEANUP_SEH) + /* + * WIN32 SEH version of cancel cleanup. + */ + +#define pthread_cleanup_push( _rout, _arg ) \ + { \ + ptw32_cleanup_t _cleanup; \ + \ + _cleanup.routine = (ptw32_cleanup_callback_t)(_rout); \ + _cleanup.arg = (_arg); \ + __try \ + { \ + +#define pthread_cleanup_pop( _execute ) \ + } \ + __finally \ + { \ + if( _execute || AbnormalTermination()) \ + { \ + (*(_cleanup.routine))( _cleanup.arg ); \ + } \ + } \ + } + +#else /* __CLEANUP_SEH */ + +#if defined(__CLEANUP_C) + + /* + * C implementation of PThreads cancel cleanup + */ + +#define pthread_cleanup_push( _rout, _arg ) \ + { \ + ptw32_cleanup_t _cleanup; \ + \ + ptw32_push_cleanup( &_cleanup, (ptw32_cleanup_callback_t) (_rout), (_arg) ); \ + +#define pthread_cleanup_pop( _execute ) \ + (void) ptw32_pop_cleanup( _execute ); \ + } + +#else /* __CLEANUP_C */ + +#if defined(__CLEANUP_CXX) + + /* + * C++ version of cancel cleanup. + * - John E. Bossom. + */ + + class PThreadCleanup { + /* + * PThreadCleanup + * + * Purpose + * This class is a C++ helper class that is + * used to implement pthread_cleanup_push/ + * pthread_cleanup_pop. + * The destructor of this class automatically + * pops the pushed cleanup routine regardless + * of how the code exits the scope + * (i.e. such as by an exception) + */ + ptw32_cleanup_callback_t cleanUpRout; + void * obj; + int executeIt; + + public: + PThreadCleanup() : + cleanUpRout( 0 ), + obj( 0 ), + executeIt( 0 ) + /* + * No cleanup performed + */ + { + } + + PThreadCleanup( + ptw32_cleanup_callback_t routine, + void * arg ) : + cleanUpRout( routine ), + obj( arg ), + executeIt( 1 ) + /* + * Registers a cleanup routine for 'arg' + */ + { + } + + ~PThreadCleanup() + { + if ( executeIt && ((void *) cleanUpRout != (void *) 0) ) + { + (void) (*cleanUpRout)( obj ); + } + } + + void execute( int exec ) + { + executeIt = exec; + } + }; + + /* + * C++ implementation of PThreads cancel cleanup; + * This implementation takes advantage of a helper + * class who's destructor automatically calls the + * cleanup routine if we exit our scope weirdly + */ +#define pthread_cleanup_push( _rout, _arg ) \ + { \ + PThreadCleanup cleanup((ptw32_cleanup_callback_t)(_rout), \ + (void *) (_arg) ); + +#define pthread_cleanup_pop( _execute ) \ + cleanup.execute( _execute ); \ + } + +#else + +#error ERROR [__FILE__, line __LINE__]: Cleanup type undefined. + +#endif /* __CLEANUP_CXX */ + +#endif /* __CLEANUP_C */ + +#endif /* __CLEANUP_SEH */ + +/* + * =============== + * =============== + * Methods + * =============== + * =============== + */ + +/* + * PThread Attribute Functions + */ +PTW32_DLLPORT int PTW32_CDECL pthread_attr_init (pthread_attr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_destroy (pthread_attr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_getdetachstate (const pthread_attr_t * attr, + int *detachstate); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstackaddr (const pthread_attr_t * attr, + void **stackaddr); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstacksize (const pthread_attr_t * attr, + size_t * stacksize); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_setdetachstate (pthread_attr_t * attr, + int detachstate); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_setstackaddr (pthread_attr_t * attr, + void *stackaddr); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_setstacksize (pthread_attr_t * attr, + size_t stacksize); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedparam (const pthread_attr_t *attr, + struct sched_param *param); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedparam (pthread_attr_t *attr, + const struct sched_param *param); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedpolicy (pthread_attr_t *, + int); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedpolicy (const pthread_attr_t *, + int *); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_setinheritsched(pthread_attr_t * attr, + int inheritsched); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_getinheritsched(const pthread_attr_t * attr, + int * inheritsched); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_setscope (pthread_attr_t *, + int); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_getscope (const pthread_attr_t *, + int *); + +/* + * PThread Functions + */ +PTW32_DLLPORT int PTW32_CDECL pthread_create (pthread_t * tid, + const pthread_attr_t * attr, + void *(PTW32_CDECL *start) (void *), + void *arg); + +PTW32_DLLPORT int PTW32_CDECL pthread_detach (pthread_t tid); + +PTW32_DLLPORT int PTW32_CDECL pthread_equal (pthread_t t1, + pthread_t t2); + +PTW32_DLLPORT void PTW32_CDECL pthread_exit (void *value_ptr); + +PTW32_DLLPORT int PTW32_CDECL pthread_join (pthread_t thread, + void **value_ptr); + +PTW32_DLLPORT pthread_t PTW32_CDECL pthread_self (void); + +PTW32_DLLPORT int PTW32_CDECL pthread_cancel (pthread_t thread); + +PTW32_DLLPORT int PTW32_CDECL pthread_setcancelstate (int state, + int *oldstate); + +PTW32_DLLPORT int PTW32_CDECL pthread_setcanceltype (int type, + int *oldtype); + +PTW32_DLLPORT void PTW32_CDECL pthread_testcancel (void); + +PTW32_DLLPORT int PTW32_CDECL pthread_once (pthread_once_t * once_control, + void (PTW32_CDECL *init_routine) (void)); + +#if PTW32_LEVEL >= PTW32_LEVEL_MAX +PTW32_DLLPORT ptw32_cleanup_t * PTW32_CDECL ptw32_pop_cleanup (int execute); + +PTW32_DLLPORT void PTW32_CDECL ptw32_push_cleanup (ptw32_cleanup_t * cleanup, + ptw32_cleanup_callback_t routine, + void *arg); +#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ + +/* + * Thread Specific Data Functions + */ +PTW32_DLLPORT int PTW32_CDECL pthread_key_create (pthread_key_t * key, + void (PTW32_CDECL *destructor) (void *)); + +PTW32_DLLPORT int PTW32_CDECL pthread_key_delete (pthread_key_t key); + +PTW32_DLLPORT int PTW32_CDECL pthread_setspecific (pthread_key_t key, + const void *value); + +PTW32_DLLPORT void * PTW32_CDECL pthread_getspecific (pthread_key_t key); + + +/* + * Mutex Attribute Functions + */ +PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_init (pthread_mutexattr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_destroy (pthread_mutexattr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getpshared (const pthread_mutexattr_t + * attr, + int *pshared); + +PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setpshared (pthread_mutexattr_t * attr, + int pshared); + +PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_settype (pthread_mutexattr_t * attr, int kind); +PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_gettype (const pthread_mutexattr_t * attr, int *kind); + +PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setrobust( + pthread_mutexattr_t *attr, + int robust); +PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getrobust( + const pthread_mutexattr_t * attr, + int * robust); + +/* + * Barrier Attribute Functions + */ +PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_init (pthread_barrierattr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_destroy (pthread_barrierattr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_getpshared (const pthread_barrierattr_t + * attr, + int *pshared); + +PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_setpshared (pthread_barrierattr_t * attr, + int pshared); + +/* + * Mutex Functions + */ +PTW32_DLLPORT int PTW32_CDECL pthread_mutex_init (pthread_mutex_t * mutex, + const pthread_mutexattr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_mutex_destroy (pthread_mutex_t * mutex); + +PTW32_DLLPORT int PTW32_CDECL pthread_mutex_lock (pthread_mutex_t * mutex); + +PTW32_DLLPORT int PTW32_CDECL pthread_mutex_timedlock(pthread_mutex_t * mutex, + const struct timespec *abstime); + +PTW32_DLLPORT int PTW32_CDECL pthread_mutex_trylock (pthread_mutex_t * mutex); + +PTW32_DLLPORT int PTW32_CDECL pthread_mutex_unlock (pthread_mutex_t * mutex); + +PTW32_DLLPORT int PTW32_CDECL pthread_mutex_consistent (pthread_mutex_t * mutex); + +/* + * Spinlock Functions + */ +PTW32_DLLPORT int PTW32_CDECL pthread_spin_init (pthread_spinlock_t * lock, int pshared); + +PTW32_DLLPORT int PTW32_CDECL pthread_spin_destroy (pthread_spinlock_t * lock); + +PTW32_DLLPORT int PTW32_CDECL pthread_spin_lock (pthread_spinlock_t * lock); + +PTW32_DLLPORT int PTW32_CDECL pthread_spin_trylock (pthread_spinlock_t * lock); + +PTW32_DLLPORT int PTW32_CDECL pthread_spin_unlock (pthread_spinlock_t * lock); + +/* + * Barrier Functions + */ +PTW32_DLLPORT int PTW32_CDECL pthread_barrier_init (pthread_barrier_t * barrier, + const pthread_barrierattr_t * attr, + unsigned int count); + +PTW32_DLLPORT int PTW32_CDECL pthread_barrier_destroy (pthread_barrier_t * barrier); + +PTW32_DLLPORT int PTW32_CDECL pthread_barrier_wait (pthread_barrier_t * barrier); + +/* + * Condition Variable Attribute Functions + */ +PTW32_DLLPORT int PTW32_CDECL pthread_condattr_init (pthread_condattr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_condattr_destroy (pthread_condattr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_condattr_getpshared (const pthread_condattr_t * attr, + int *pshared); + +PTW32_DLLPORT int PTW32_CDECL pthread_condattr_setpshared (pthread_condattr_t * attr, + int pshared); + +/* + * Condition Variable Functions + */ +PTW32_DLLPORT int PTW32_CDECL pthread_cond_init (pthread_cond_t * cond, + const pthread_condattr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_cond_destroy (pthread_cond_t * cond); + +PTW32_DLLPORT int PTW32_CDECL pthread_cond_wait (pthread_cond_t * cond, + pthread_mutex_t * mutex); + +PTW32_DLLPORT int PTW32_CDECL pthread_cond_timedwait (pthread_cond_t * cond, + pthread_mutex_t * mutex, + const struct timespec *abstime); + +PTW32_DLLPORT int PTW32_CDECL pthread_cond_signal (pthread_cond_t * cond); + +PTW32_DLLPORT int PTW32_CDECL pthread_cond_broadcast (pthread_cond_t * cond); + +/* + * Scheduling + */ +PTW32_DLLPORT int PTW32_CDECL pthread_setschedparam (pthread_t thread, + int policy, + const struct sched_param *param); + +PTW32_DLLPORT int PTW32_CDECL pthread_getschedparam (pthread_t thread, + int *policy, + struct sched_param *param); + +PTW32_DLLPORT int PTW32_CDECL pthread_setconcurrency (int); + +PTW32_DLLPORT int PTW32_CDECL pthread_getconcurrency (void); + +/* + * Read-Write Lock Functions + */ +PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_init(pthread_rwlock_t *lock, + const pthread_rwlockattr_t *attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_destroy(pthread_rwlock_t *lock); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_tryrdlock(pthread_rwlock_t *); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_trywrlock(pthread_rwlock_t *); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_rdlock(pthread_rwlock_t *lock); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_timedrdlock(pthread_rwlock_t *lock, + const struct timespec *abstime); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_wrlock(pthread_rwlock_t *lock); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_timedwrlock(pthread_rwlock_t *lock, + const struct timespec *abstime); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_unlock(pthread_rwlock_t *lock); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_init (pthread_rwlockattr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_destroy (pthread_rwlockattr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * attr, + int *pshared); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_setpshared (pthread_rwlockattr_t * attr, + int pshared); + +#if PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 + +/* + * Signal Functions. Should be defined in but MSVC and MinGW32 + * already have signal.h that don't define these. + */ +PTW32_DLLPORT int PTW32_CDECL pthread_kill(pthread_t thread, int sig); + +/* + * Non-portable functions + */ + +/* + * Compatibility with Linux. + */ +PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setkind_np(pthread_mutexattr_t * attr, + int kind); +PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getkind_np(pthread_mutexattr_t * attr, + int *kind); + +/* + * Possibly supported by other POSIX threads implementations + */ +PTW32_DLLPORT int PTW32_CDECL pthread_delay_np (struct timespec * interval); +PTW32_DLLPORT int PTW32_CDECL pthread_num_processors_np(void); +PTW32_DLLPORT unsigned __int64 PTW32_CDECL pthread_getunique_np(pthread_t thread); + +/* + * Useful if an application wants to statically link + * the lib rather than load the DLL at run-time. + */ +PTW32_DLLPORT int PTW32_CDECL pthread_win32_process_attach_np(void); +PTW32_DLLPORT int PTW32_CDECL pthread_win32_process_detach_np(void); +PTW32_DLLPORT int PTW32_CDECL pthread_win32_thread_attach_np(void); +PTW32_DLLPORT int PTW32_CDECL pthread_win32_thread_detach_np(void); + +/* + * Features that are auto-detected at load/run time. + */ +PTW32_DLLPORT int PTW32_CDECL pthread_win32_test_features_np(int); +enum ptw32_features { + PTW32_SYSTEM_INTERLOCKED_COMPARE_EXCHANGE = 0x0001, /* System provides it. */ + PTW32_ALERTABLE_ASYNC_CANCEL = 0x0002 /* Can cancel blocked threads. */ +}; + +/* + * Register a system time change with the library. + * Causes the library to perform various functions + * in response to the change. Should be called whenever + * the application's top level window receives a + * WM_TIMECHANGE message. It can be passed directly to + * pthread_create() as a new thread if desired. + */ +PTW32_DLLPORT void * PTW32_CDECL pthread_timechange_handler_np(void *); + +#endif /*PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 */ + +#if PTW32_LEVEL >= PTW32_LEVEL_MAX + +/* + * Returns the Win32 HANDLE for the POSIX thread. + */ +PTW32_DLLPORT HANDLE PTW32_CDECL pthread_getw32threadhandle_np(pthread_t thread); +/* + * Returns the win32 thread ID for POSIX thread. + */ +PTW32_DLLPORT DWORD PTW32_CDECL pthread_getw32threadid_np (pthread_t thread); + + +/* + * Protected Methods + * + * This function blocks until the given WIN32 handle + * is signaled or pthread_cancel had been called. + * This function allows the caller to hook into the + * PThreads cancel mechanism. It is implemented using + * + * WaitForMultipleObjects + * + * on 'waitHandle' and a manually reset WIN32 Event + * used to implement pthread_cancel. The 'timeout' + * argument to TimedWait is simply passed to + * WaitForMultipleObjects. + */ +PTW32_DLLPORT int PTW32_CDECL pthreadCancelableWait (HANDLE waitHandle); +PTW32_DLLPORT int PTW32_CDECL pthreadCancelableTimedWait (HANDLE waitHandle, + DWORD timeout); + +#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ + +/* + * Thread-Safe C Runtime Library Mappings. + */ +#if !defined(_UWIN) +# if defined(NEED_ERRNO) + PTW32_DLLPORT int * PTW32_CDECL _errno( void ); +# else +# if !defined(errno) +# if (defined(_MT) || defined(_DLL)) + __declspec(dllimport) extern int * __cdecl _errno(void); +# define errno (*_errno()) +# endif +# endif +# endif +#endif + +/* + * Some compiler environments don't define some things. + */ +#if defined(__BORLANDC__) +# define _ftime ftime +# define _timeb timeb +#endif + +#if defined(__cplusplus) + +/* + * Internal exceptions + */ +class ptw32_exception {}; +class ptw32_exception_cancel : public ptw32_exception {}; +class ptw32_exception_exit : public ptw32_exception {}; + +#endif + +#if PTW32_LEVEL >= PTW32_LEVEL_MAX + +/* FIXME: This is only required if the library was built using SEH */ +/* + * Get internal SEH tag + */ +PTW32_DLLPORT DWORD PTW32_CDECL ptw32_get_exception_services_code(void); + +#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ + +#if !defined(PTW32_BUILD) + +#if defined(__CLEANUP_SEH) + +/* + * Redefine the SEH __except keyword to ensure that applications + * propagate our internal exceptions up to the library's internal handlers. + */ +#define __except( E ) \ + __except( ( GetExceptionCode() == ptw32_get_exception_services_code() ) \ + ? EXCEPTION_CONTINUE_SEARCH : ( E ) ) + +#endif /* __CLEANUP_SEH */ + +#if defined(__CLEANUP_CXX) + +/* + * Redefine the C++ catch keyword to ensure that applications + * propagate our internal exceptions up to the library's internal handlers. + */ +#if defined(_MSC_VER) + /* + * WARNING: Replace any 'catch( ... )' with 'PtW32CatchAll' + * if you want Pthread-Win32 cancelation and pthread_exit to work. + */ + +#if !defined(PtW32NoCatchWarn) + +#pragma message("Specify \"/DPtW32NoCatchWarn\" compiler flag to skip this message.") +#pragma message("------------------------------------------------------------------") +#pragma message("When compiling applications with MSVC++ and C++ exception handling:") +#pragma message(" Replace any 'catch( ... )' in routines called from POSIX threads") +#pragma message(" with 'PtW32CatchAll' or 'CATCHALL' if you want POSIX thread") +#pragma message(" cancelation and pthread_exit to work. For example:") +#pragma message("") +#pragma message(" #if defined(PtW32CatchAll)") +#pragma message(" PtW32CatchAll") +#pragma message(" #else") +#pragma message(" catch(...)") +#pragma message(" #endif") +#pragma message(" {") +#pragma message(" /* Catchall block processing */") +#pragma message(" }") +#pragma message("------------------------------------------------------------------") + +#endif + +#define PtW32CatchAll \ + catch( ptw32_exception & ) { throw; } \ + catch( ... ) + +#else /* _MSC_VER */ + +#define catch( E ) \ + catch( ptw32_exception & ) { throw; } \ + catch( E ) + +#endif /* _MSC_VER */ + +#endif /* __CLEANUP_CXX */ + +#endif /* ! PTW32_BUILD */ + +#if defined(__cplusplus) +} /* End of extern "C" */ +#endif /* __cplusplus */ + +#if defined(PTW32__HANDLE_DEF) +# undef HANDLE +#endif +#if defined(PTW32__DWORD_DEF) +# undef DWORD +#endif + +#undef PTW32_LEVEL +#undef PTW32_LEVEL_MAX + +#endif /* ! RC_INVOKED */ + +#endif /* PTHREAD_H */ diff --git a/dependencies/pthreads/include/sched.h b/dependencies/pthreads/include/sched.h new file mode 100644 index 0000000..f36a97a --- /dev/null +++ b/dependencies/pthreads/include/sched.h @@ -0,0 +1,183 @@ +/* + * Module: sched.h + * + * Purpose: + * Provides an implementation of POSIX realtime extensions + * as defined in + * + * POSIX 1003.1b-1993 (POSIX.1b) + * + * -------------------------------------------------------------------------- + * + * Pthreads-win32 - POSIX Threads Library for Win32 + * Copyright(C) 1998 John E. Bossom + * Copyright(C) 1999,2005 Pthreads-win32 contributors + * + * Contact Email: rpj@callisto.canberra.edu.au + * + * The current list of contributors is contained + * in the file CONTRIBUTORS included with the source + * code distribution. The list can also be seen at the + * following World Wide Web location: + * http://sources.redhat.com/pthreads-win32/contributors.html + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library in the file COPYING.LIB; + * if not, write to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ +#if !defined(_SCHED_H) +#define _SCHED_H + +#undef PTW32_SCHED_LEVEL + +#if defined(_POSIX_SOURCE) +#define PTW32_SCHED_LEVEL 0 +/* Early POSIX */ +#endif + +#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309 +#undef PTW32_SCHED_LEVEL +#define PTW32_SCHED_LEVEL 1 +/* Include 1b, 1c and 1d */ +#endif + +#if defined(INCLUDE_NP) +#undef PTW32_SCHED_LEVEL +#define PTW32_SCHED_LEVEL 2 +/* Include Non-Portable extensions */ +#endif + +#define PTW32_SCHED_LEVEL_MAX 3 + +#if ( defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112 ) || !defined(PTW32_SCHED_LEVEL) +#define PTW32_SCHED_LEVEL PTW32_SCHED_LEVEL_MAX +/* Include everything */ +#endif + + +#if defined(__GNUC__) && !defined(__declspec) +# error Please upgrade your GNU compiler to one that supports __declspec. +#endif + +/* + * When building the library, you should define PTW32_BUILD so that + * the variables/functions are exported correctly. When using the library, + * do NOT define PTW32_BUILD, and then the variables/functions will + * be imported correctly. + */ +#if !defined(PTW32_STATIC_LIB) +# if defined(PTW32_BUILD) +# define PTW32_DLLPORT __declspec (dllexport) +# else +# define PTW32_DLLPORT __declspec (dllimport) +# endif +#else +# define PTW32_DLLPORT +#endif + +/* + * This is a duplicate of what is in the autoconf config.h, + * which is only used when building the pthread-win32 libraries. + */ + +#if !defined(PTW32_CONFIG_H) +# if defined(WINCE) +# define NEED_ERRNO +# define NEED_SEM +# endif +# if defined(__MINGW64__) +# define HAVE_STRUCT_TIMESPEC +# define HAVE_MODE_T +# elif defined(_UWIN) || defined(__MINGW32__) +# define HAVE_MODE_T +# endif +#endif + +/* + * + */ + +#if PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX +#if defined(NEED_ERRNO) +#include "need_errno.h" +#else +#include +#endif +#endif /* PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX */ + +#if (defined(__MINGW64__) || defined(__MINGW32__)) || defined(_UWIN) +# if PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX +/* For pid_t */ +# include +/* Required by Unix 98 */ +# include +# else + typedef int pid_t; +# endif +#else + typedef int pid_t; +#endif + +/* Thread scheduling policies */ + +enum { + SCHED_OTHER = 0, + SCHED_FIFO, + SCHED_RR, + SCHED_MIN = SCHED_OTHER, + SCHED_MAX = SCHED_RR +}; + +struct sched_param { + int sched_priority; +}; + +#if defined(__cplusplus) +extern "C" +{ +#endif /* __cplusplus */ + +PTW32_DLLPORT int __cdecl sched_yield (void); + +PTW32_DLLPORT int __cdecl sched_get_priority_min (int policy); + +PTW32_DLLPORT int __cdecl sched_get_priority_max (int policy); + +PTW32_DLLPORT int __cdecl sched_setscheduler (pid_t pid, int policy); + +PTW32_DLLPORT int __cdecl sched_getscheduler (pid_t pid); + +/* + * Note that this macro returns ENOTSUP rather than + * ENOSYS as might be expected. However, returning ENOSYS + * should mean that sched_get_priority_{min,max} are + * not implemented as well as sched_rr_get_interval. + * This is not the case, since we just don't support + * round-robin scheduling. Therefore I have chosen to + * return the same value as sched_setscheduler when + * SCHED_RR is passed to it. + */ +#define sched_rr_get_interval(_pid, _interval) \ + ( errno = ENOTSUP, (int) -1 ) + + +#if defined(__cplusplus) +} /* End of extern "C" */ +#endif /* __cplusplus */ + +#undef PTW32_SCHED_LEVEL +#undef PTW32_SCHED_LEVEL_MAX + +#endif /* !_SCHED_H */ + diff --git a/dependencies/pthreads/include/semaphore.h b/dependencies/pthreads/include/semaphore.h new file mode 100644 index 0000000..c6e9407 --- /dev/null +++ b/dependencies/pthreads/include/semaphore.h @@ -0,0 +1,169 @@ +/* + * Module: semaphore.h + * + * Purpose: + * Semaphores aren't actually part of the PThreads standard. + * They are defined by the POSIX Standard: + * + * POSIX 1003.1b-1993 (POSIX.1b) + * + * -------------------------------------------------------------------------- + * + * Pthreads-win32 - POSIX Threads Library for Win32 + * Copyright(C) 1998 John E. Bossom + * Copyright(C) 1999,2005 Pthreads-win32 contributors + * + * Contact Email: rpj@callisto.canberra.edu.au + * + * The current list of contributors is contained + * in the file CONTRIBUTORS included with the source + * code distribution. The list can also be seen at the + * following World Wide Web location: + * http://sources.redhat.com/pthreads-win32/contributors.html + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library in the file COPYING.LIB; + * if not, write to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ +#if !defined( SEMAPHORE_H ) +#define SEMAPHORE_H + +#undef PTW32_SEMAPHORE_LEVEL + +#if defined(_POSIX_SOURCE) +#define PTW32_SEMAPHORE_LEVEL 0 +/* Early POSIX */ +#endif + +#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309 +#undef PTW32_SEMAPHORE_LEVEL +#define PTW32_SEMAPHORE_LEVEL 1 +/* Include 1b, 1c and 1d */ +#endif + +#if defined(INCLUDE_NP) +#undef PTW32_SEMAPHORE_LEVEL +#define PTW32_SEMAPHORE_LEVEL 2 +/* Include Non-Portable extensions */ +#endif + +#define PTW32_SEMAPHORE_LEVEL_MAX 3 + +#if !defined(PTW32_SEMAPHORE_LEVEL) +#define PTW32_SEMAPHORE_LEVEL PTW32_SEMAPHORE_LEVEL_MAX +/* Include everything */ +#endif + +#if defined(__GNUC__) && ! defined (__declspec) +# error Please upgrade your GNU compiler to one that supports __declspec. +#endif + +/* + * When building the library, you should define PTW32_BUILD so that + * the variables/functions are exported correctly. When using the library, + * do NOT define PTW32_BUILD, and then the variables/functions will + * be imported correctly. + */ +#if !defined(PTW32_STATIC_LIB) +# if defined(PTW32_BUILD) +# define PTW32_DLLPORT __declspec (dllexport) +# else +# define PTW32_DLLPORT __declspec (dllimport) +# endif +#else +# define PTW32_DLLPORT +#endif + +/* + * This is a duplicate of what is in the autoconf config.h, + * which is only used when building the pthread-win32 libraries. + */ + +#if !defined(PTW32_CONFIG_H) +# if defined(WINCE) +# define NEED_ERRNO +# define NEED_SEM +# endif +# if defined(__MINGW64__) +# define HAVE_STRUCT_TIMESPEC +# define HAVE_MODE_T +# elif defined(_UWIN) || defined(__MINGW32__) +# define HAVE_MODE_T +# endif +#endif + +/* + * + */ + +#if PTW32_SEMAPHORE_LEVEL >= PTW32_SEMAPHORE_LEVEL_MAX +#if defined(NEED_ERRNO) +#include "need_errno.h" +#else +#include +#endif +#endif /* PTW32_SEMAPHORE_LEVEL >= PTW32_SEMAPHORE_LEVEL_MAX */ + +#define _POSIX_SEMAPHORES + +#if defined(__cplusplus) +extern "C" +{ +#endif /* __cplusplus */ + +#if !defined(HAVE_MODE_T) +typedef unsigned int mode_t; +#endif + + +typedef struct sem_t_ * sem_t; + +PTW32_DLLPORT int __cdecl sem_init (sem_t * sem, + int pshared, + unsigned int value); + +PTW32_DLLPORT int __cdecl sem_destroy (sem_t * sem); + +PTW32_DLLPORT int __cdecl sem_trywait (sem_t * sem); + +PTW32_DLLPORT int __cdecl sem_wait (sem_t * sem); + +PTW32_DLLPORT int __cdecl sem_timedwait (sem_t * sem, + const struct timespec * abstime); + +PTW32_DLLPORT int __cdecl sem_post (sem_t * sem); + +PTW32_DLLPORT int __cdecl sem_post_multiple (sem_t * sem, + int count); + +PTW32_DLLPORT int __cdecl sem_open (const char * name, + int oflag, + mode_t mode, + unsigned int value); + +PTW32_DLLPORT int __cdecl sem_close (sem_t * sem); + +PTW32_DLLPORT int __cdecl sem_unlink (const char * name); + +PTW32_DLLPORT int __cdecl sem_getvalue (sem_t * sem, + int * sval); + +#if defined(__cplusplus) +} /* End of extern "C" */ +#endif /* __cplusplus */ + +#undef PTW32_SEMAPHORE_LEVEL +#undef PTW32_SEMAPHORE_LEVEL_MAX + +#endif /* !SEMAPHORE_H */ diff --git a/dependencies/pthreads/lib/mingw/libpthreadGC2.a b/dependencies/pthreads/lib/mingw/libpthreadGC2.a new file mode 100644 index 0000000..df21175 Binary files /dev/null and b/dependencies/pthreads/lib/mingw/libpthreadGC2.a differ diff --git a/dependencies/pthreads/lib/mingw/pthreadGC2.dll b/dependencies/pthreads/lib/mingw/pthreadGC2.dll new file mode 100644 index 0000000..67b9289 Binary files /dev/null and b/dependencies/pthreads/lib/mingw/pthreadGC2.dll differ diff --git a/dependencies/pthreads/lib/msvc/pthreadVC2.dll b/dependencies/pthreads/lib/msvc/pthreadVC2.dll new file mode 100644 index 0000000..fcb5d9d Binary files /dev/null and b/dependencies/pthreads/lib/msvc/pthreadVC2.dll differ diff --git a/dependencies/pthreads/lib/msvc/pthreadVC2.lib b/dependencies/pthreads/lib/msvc/pthreadVC2.lib new file mode 100644 index 0000000..c20ee20 Binary files /dev/null and b/dependencies/pthreads/lib/msvc/pthreadVC2.lib differ diff --git a/third-party-libs/zlib/include/zconf.h b/dependencies/zlib/include/zconf.h similarity index 99% rename from third-party-libs/zlib/include/zconf.h rename to dependencies/zlib/include/zconf.h index 9987a77..9ccbb0a 100644 --- a/third-party-libs/zlib/include/zconf.h +++ b/dependencies/zlib/include/zconf.h @@ -7,6 +7,8 @@ #ifndef ZCONF_H #define ZCONF_H +/* #undef Z_PREFIX */ +/* #undef Z_HAVE_UNISTD_H */ /* * If you *really* need a unique prefix for all types and library functions, diff --git a/third-party-libs/zlib/include/zlib.h b/dependencies/zlib/include/zlib.h similarity index 100% rename from third-party-libs/zlib/include/zlib.h rename to dependencies/zlib/include/zlib.h diff --git a/dependencies/zlib/lib/mingw/libz.a b/dependencies/zlib/lib/mingw/libz.a new file mode 100644 index 0000000..bfaf07d Binary files /dev/null and b/dependencies/zlib/lib/mingw/libz.a differ diff --git a/dependencies/zlib/lib/msvc/libz.lib b/dependencies/zlib/lib/msvc/libz.lib new file mode 100644 index 0000000..a352088 Binary files /dev/null and b/dependencies/zlib/lib/msvc/libz.lib differ diff --git a/release/user-input.json b/release/defaults.json similarity index 63% rename from release/user-input.json rename to release/defaults.json index d3c0d08..33f5d15 100644 --- a/release/user-input.json +++ b/release/defaults.json @@ -1,13 +1,13 @@ { "export-attachments": true, "exportMaterials": true, - "input-blueprint-folder": "C:\\Program Files (x86)\\StarMade\\blueprints\\Isanth Type-Zero Mb", - "input-data-folder": "C:\\Program Files (x86)\\data", + "input-blueprint-folder": "E:\\Program Files (x86)\\StarMade\\StarMade\\blueprints\\BLUEPRINT_1439984067219", + "input-data-folder": "E:\\Program Files (x86)\\StarMade\\StarMade\\data", "num-of-threads": "8", "output-file-folder": "C:\\output", "output-texture-folder": "C:\\output\\textures", "specular-highlight": false, - "texture-export-type": 0, + "texture-export-type": 1, "texture-normals": 1, "texture-output-format": 0, "texture-tile-size": 2, @@ -15,5 +15,5 @@ "use-diffuse-textures": true, "use-emissive-textures": true, "use-normal-textures": true, - "uv-maps-options": 1 + "uv-maps-options": 2 } \ No newline at end of file diff --git a/source/defaults.cpp b/source/defaults.cpp index 953c894..43cc54a 100644 --- a/source/defaults.cpp +++ b/source/defaults.cpp @@ -29,8 +29,8 @@ sm2obj::defaults::defaults(){ sm2obj::defaults::~defaults(){ } -bool sm2obj::defaults::load(const std::string& Path){ - return deserializeAsJson(Path, NULL); +bool sm2obj::defaults::load(const std::string& Path, std::vector* Missing){ + return deserializeAsJson(Path, Missing); } bool sm2obj::defaults::save(const std::string& Path){ diff --git a/source/defaults.h b/source/defaults.h index 40cf75d..3189a6c 100644 --- a/source/defaults.h +++ b/source/defaults.h @@ -14,7 +14,7 @@ namespace sm2obj { public: defaults(); ~defaults(); - bool load(const std::string& Path); + bool load(const std::string& Path, std::vector* Missing); bool save(const std::string& Path); std::string inputBlueprintFolder; diff --git a/source/exporter/blockConfig.cpp b/source/exporter/blockConfig.cpp index 1d1db44..d469b16 100644 --- a/source/exporter/blockConfig.cpp +++ b/source/exporter/blockConfig.cpp @@ -43,15 +43,15 @@ static std::string fixSpaces(const std::string& Str){ } ///============================================================================= -bool sm2obj::loadBlockTypes(const std::string& Path){ +bool sm2obj::loadBlockTypes(const exportBlueprintArgs& Args, const std::string& Path){ // Open file for input ffw::file input; if(!input.open(Path, false, false, false)){ - LOG_ERROR("Failed to read block types from: " + Path); + Args.callbackLogError("Failed to read block types from: " + Path); return false; } - LOG_INFO("Reading block type properties..."); + Args.callbackLogInfo("Reading block type properties..."); int lineNumber = 0; while(!input.eof()){ @@ -70,13 +70,13 @@ bool sm2obj::loadBlockTypes(const std::string& Path){ try { id = ffw::stringToVal(tokens[1]); - } catch (std::exception& e){ - LOG_WARNING("Error reading type ID at line: " + ffw::valToString(lineNumber)); + } catch (std::exception e){ + Args.callbackLogWarning("Error reading type ID at line: " + ffw::valToString(lineNumber)); continue; } if(tokens[0].size() == 0){ - LOG_WARNING("Error reading type name at line: " + ffw::valToString(lineNumber)); + Args.callbackLogWarning("Error reading type name at line: " + ffw::valToString(lineNumber)); continue; } @@ -84,7 +84,7 @@ bool sm2obj::loadBlockTypes(const std::string& Path){ } } - LOG_DEBUG("Loaded: " + ffw::valToString(blocksType.size()) + " block types!"); + Args.callbackLogDebug("Loaded: " + ffw::valToString(blocksType.size()) + " block types!"); return true; } @@ -121,15 +121,15 @@ void sm2obj::clearBlockConfig(){ } ///============================================================================= -bool sm2obj::loadBlockConfig(const std::string& Path){ +bool sm2obj::loadBlockConfig(const exportBlueprintArgs& Args, const std::string& Path){ // Open file for input ffw::file input; if(!input.open(Path, false, false, false)){ - LOG_ERROR("Failed to read block config from: " + Path); + Args.callbackLogError("Failed to read block config from: " + Path); return false; } - LOG_INFO("Reading block config..."); + Args.callbackLogInfo("Reading block config..."); // Loop through all lines int lineNumber = 0; @@ -143,7 +143,7 @@ bool sm2obj::loadBlockConfig(const std::string& Path){ if(line.find("(tokens[1].substr(1, pos-1)); - } catch (std::exception& e){ - LOG_WARNING("Error reading icon data at line: " + ffw::valToString(lineNumber)); + } catch (std::exception e){ + Args.callbackLogWarning("Error reading icon data at line: " + ffw::valToString(lineNumber)); blocksInfo.pop_back(); continue; } @@ -165,7 +165,7 @@ bool sm2obj::loadBlockConfig(const std::string& Path){ if(pos != std::string::npos){ newBlock.name = tokens[2].substr(1, pos-1); if(newBlock.name.size() == 0){ - LOG_WARNING("Error reading name data at line: " + ffw::valToString(lineNumber)); + Args.callbackLogWarning("Error reading name data at line: " + ffw::valToString(lineNumber)); blocksInfo.pop_back(); continue; } @@ -176,7 +176,7 @@ bool sm2obj::loadBlockConfig(const std::string& Path){ if(pos != std::string::npos){ std::vector texTokens = ffw::getTokens(tokens[3].substr(1, pos-1), ','); if(texTokens.size() != 6){ - LOG_WARNING("Error reading texture data at line: " + ffw::valToString(lineNumber)); + Args.callbackLogWarning("Error reading texture data at line: " + ffw::valToString(lineNumber)); blocksInfo.pop_back(); continue; } @@ -186,8 +186,8 @@ bool sm2obj::loadBlockConfig(const std::string& Path){ newBlock.texture[i] = ffw::stringToVal(texTokens[i]); } - } catch (std::exception& e){ - LOG_WARNING("Error reading texture data at line: " + ffw::valToString(lineNumber)); + } catch (std::exception e){ + Args.callbackLogWarning("Error reading texture data at line: " + ffw::valToString(lineNumber)); blocksInfo.pop_back(); continue; } @@ -197,14 +197,14 @@ bool sm2obj::loadBlockConfig(const std::string& Path){ if(pos != std::string::npos){ std::string type = tokens[4].substr(1, pos-1); if(type.size() == 0){ - LOG_WARNING("Error reading type data at line: " + ffw::valToString(lineNumber)); + Args.callbackLogWarning("Error reading type data at line: " + ffw::valToString(lineNumber)); blocksInfo.pop_back(); continue; } int id = findBlockType(type); if(id == -1){ - LOG_WARNING("Could not find ID for type: " + type); + Args.callbackLogWarning("Could not find ID for type: " + type); continue; } @@ -233,11 +233,11 @@ bool sm2obj::loadBlockConfig(const std::string& Path){ blocksInfo[blocksInfo.size()-1].light.a = ffw::stringToVal(tokens[3]); success = true; - } catch (std::exception& e){ + } catch (std::exception e){ // Nothing to do } } - if(!success)LOG_WARNING("Error reading light source color data at line: " + ffw::valToString(lineNumber)); + if(!success)Args.callbackLogWarning("Error reading light source color data at line: " + ffw::valToString(lineNumber)); } } else if(blocksInfo.size() > 0 && (first = line.find("")) != std::string::npos){ @@ -248,15 +248,15 @@ bool sm2obj::loadBlockConfig(const std::string& Path){ blocksInfo[blocksInfo.size()-1].object = ffw::stringToVal(line.substr(first+12, last-first-12)); success = true; - } catch (std::exception& e){ + } catch (std::exception e){ // Nothing to do } } - if(!success)LOG_WARNING("Error reading block style as int at line: " + ffw::valToString(lineNumber)); + if(!success)Args.callbackLogWarning("Error reading block style as int at line: " + ffw::valToString(lineNumber)); } } - LOG_DEBUG("Loaded: " + ffw::valToString(blocksInfo.size()) + " blocks!"); + Args.callbackLogDebug("Loaded: " + ffw::valToString(blocksInfo.size()) + " blocks!"); return true; } diff --git a/source/exporter/blockConfig.h b/source/exporter/blockConfig.h index a70b6c8..6272b19 100644 --- a/source/exporter/blockConfig.h +++ b/source/exporter/blockConfig.h @@ -8,6 +8,7 @@ #define SMD2OBJ_BLOCK_CONFIG #include +#include "config.h" namespace sm2obj{ // Block info @@ -39,8 +40,8 @@ namespace sm2obj{ }; void clearBlockConfig(); - bool loadBlockTypes(const std::string& Path); - bool loadBlockConfig(const std::string& Path); + bool loadBlockTypes(const exportBlueprintArgs& Args, const std::string& Path); + bool loadBlockConfig(const exportBlueprintArgs& Args, const std::string& Path); const blockInfoStruct* findBlock(int ID); const blockInfoStruct* findBlockByTexture(int Index); }; diff --git a/source/exporter/blockConstructor.cpp b/source/exporter/blockConstructor.cpp index 3dd715d..2ffb3c3 100644 --- a/source/exporter/blockConstructor.cpp +++ b/source/exporter/blockConstructor.cpp @@ -32,7 +32,7 @@ static void getBlock(uint32_t Buffer[][16][16], int* BlockID, int* RotA, int* Ro } ///============================================================================= -bool sm2obj::buildBlock(ffw::vec3i Pos, ffw::vec3i PosRel, ffw::vec3i PosFile, uint32_t ChunkData[][16][16], chunkBufferStruct* Output){ +bool sm2obj::buildBlock(const exportBlueprintArgs& Args, ffw::vec3i Pos, ffw::vec3i PosRel, ffw::vec3i PosFile, uint32_t ChunkData[][16][16], chunkBufferStruct* Output){ int id; int rotA; int rotB; @@ -47,7 +47,7 @@ bool sm2obj::buildBlock(ffw::vec3i Pos, ffw::vec3i PosRel, ffw::vec3i PosFile, u const blockInfoStruct* block = findBlock(id); if(block == NULL){ // Can not find block ID - LOG_WARNING("Can not find block ID: " + ffw::valToString(id)); + Args.callbackLogWarning("Can not find block ID: " + ffw::valToString(id)); } else { // -1 = undefined // 0 = cube diff --git a/source/exporter/blockConstructor.h b/source/exporter/blockConstructor.h index c9c86aa..e8c8076 100644 --- a/source/exporter/blockConstructor.h +++ b/source/exporter/blockConstructor.h @@ -11,7 +11,7 @@ #include "config.h" namespace sm2obj{ - bool buildBlock(ffw::vec3i Pos, ffw::vec3i PosRel, ffw::vec3i PosFile, uint32_t ChunkData[][16][16], chunkBufferStruct* Output); + bool buildBlock(const exportBlueprintArgs& Args, ffw::vec3i Pos, ffw::vec3i PosRel, ffw::vec3i PosFile, uint32_t ChunkData[][16][16], chunkBufferStruct* Output); } #endif diff --git a/source/exporter/blockExtractor.cpp b/source/exporter/blockExtractor.cpp index a634c1b..502e621 100644 --- a/source/exporter/blockExtractor.cpp +++ b/source/exporter/blockExtractor.cpp @@ -13,11 +13,11 @@ //static std::vector extractedTiles; ///============================================================================= -bool sm2obj::loadRawBlocks(const std::string& TempFolder, chunkBufferStruct* Input, int FileIndex){ +bool sm2obj::loadRawBlocks(const exportBlueprintArgs& Args, const std::string& TempFolder, chunkBufferStruct* Input, int FileIndex){ ffw::file input; if(!input.open(TempFolder + "\\chunk-temp-processed-" + ffw::valToString(FileIndex) + ".raw", true, false, false)){ - LOG_ERROR("Failed to load processed raw chunk data! Chunk index: " + ffw::valToString(FileIndex)); + Args.callbackLogError("Failed to load processed raw chunk data! Chunk index: " + ffw::valToString(FileIndex)); return false; } @@ -54,11 +54,11 @@ bool sm2obj::loadRawBlocks(const std::string& TempFolder, chunkBufferStruct* Inp } ///============================================================================= -bool sm2obj::saveRawBlocks(const std::string& TempFolder, chunkBufferStruct* Input, int FileIndex){ +bool sm2obj::saveRawBlocks(const exportBlueprintArgs& Args, const std::string& TempFolder, chunkBufferStruct* Input, int FileIndex){ ffw::file output; if(!output.open(TempFolder + "\\chunk-temp-processed-" + ffw::valToString(FileIndex) + ".raw", true, true, true)){ - LOG_ERROR("Failed to svae processed raw chunk data! Chunk index: " + ffw::valToString(FileIndex)); + Args.callbackLogError("Failed to svae processed raw chunk data! Chunk index: " + ffw::valToString(FileIndex)); return false; } @@ -95,18 +95,17 @@ bool sm2obj::saveRawBlocks(const std::string& TempFolder, chunkBufferStruct* Inp } ///============================================================================= -bool sm2obj::extractBlocks(const std::string& TempFolder, chunkBufferStruct* Input, int FileIndex, - bool ExportMaterials, bool SplitTextures, bool ExportUvMaps, uint64_t* IndicesOffset, uint64_t* TexPosOffset){ +bool sm2obj::extractBlocks(const exportBlueprintArgs& Args, const std::string& TempFolder, chunkBufferStruct* Input, int FileIndex, uint64_t* IndicesOffset, uint64_t* TexPosOffset){ ffw::file vertices; ffw::file indices; if(!vertices.open(TempFolder + "\\chunk-temp-" + ffw::valToString(FileIndex) + ".vertices", false, true, true)){ - LOG_ERROR("Failed to svae chunk vertices! Chunk index: " + ffw::valToString(FileIndex)); + Args.callbackLogError("Failed to svae chunk vertices! Chunk index: " + ffw::valToString(FileIndex)); return false; } if(!indices.open(TempFolder + "\\chunk-temp-" + ffw::valToString(FileIndex) + ".indices", false, true, true)){ - LOG_ERROR("Failed to svae chunk indices! Chunk index: " + ffw::valToString(FileIndex)); + Args.callbackLogError("Failed to svae chunk indices! Chunk index: " + ffw::valToString(FileIndex)); return false; } @@ -124,7 +123,7 @@ bool sm2obj::extractBlocks(const std::string& TempFolder, chunkBufferStruct* Inp int currentTextureOffset = 0; const blockInfoStruct* block = NULL; for(uint32_t i = 0; i < Input->indicesCount; i++){ - if(SplitTextures && ExportMaterials && (lastId != Input->indicesMat[i][0] || lastTex != Input->indicesMat[i][1])){ + if(!Args.useAtlas && Args.exportMaterials && (lastId != Input->indicesMat[i][0] || lastTex != Input->indicesMat[i][1])){ lastId = Input->indicesMat[i][0]; lastTex = Input->indicesMat[i][1]; block = findBlock(lastId); @@ -147,7 +146,7 @@ bool sm2obj::extractBlocks(const std::string& TempFolder, chunkBufferStruct* Inp } - if(!SplitTextures && ExportMaterials && lastTex != Input->indicesMat[i][1]){ + if(Args.useAtlas && Args.exportMaterials && lastTex != Input->indicesMat[i][1]){ lastTex = Input->indicesMat[i][1]; if(lastAtlas != Input->indicesMat[i][1] / 256){ @@ -165,7 +164,7 @@ bool sm2obj::extractBlocks(const std::string& TempFolder, chunkBufferStruct* Inp } } - if(ExportUvMaps){ + if(Args.exportUV){ if(Input->indices[i].w == -1){ indices.writeLine("f " + ffw::valToString(Input->indices[i].x + (*IndicesOffset) +1) + "/" + ffw::valToString(Input->indicesUvs[i].x + (*TexPosOffset) + currentTextureOffset*4) + " " diff --git a/source/exporter/blockExtractor.h b/source/exporter/blockExtractor.h index 6469715..cbe6403 100644 --- a/source/exporter/blockExtractor.h +++ b/source/exporter/blockExtractor.h @@ -14,9 +14,9 @@ namespace sm2obj{ //void resetIndiceOffset(); //void resetMaterials(); //const std::vector& getExtractedTiles(); - bool saveRawBlocks(const std::string& TempFolder, chunkBufferStruct* Input, int FileIndex); - bool loadRawBlocks(const std::string& TempFolder, chunkBufferStruct* Input, int FileIndex); - bool extractBlocks(const std::string& TempFolder, chunkBufferStruct* Input, int FileIndex, bool ExportMaterials, bool SplitTextures, bool ExportUvMaps, uint64_t* IndicesOffset, uint64_t* TexPosOffset); + bool saveRawBlocks(const exportBlueprintArgs& Args, const std::string& TempFolder, chunkBufferStruct* Input, int FileIndex); + bool loadRawBlocks(const exportBlueprintArgs& Args, const std::string& TempFolder, chunkBufferStruct* Input, int FileIndex); + bool extractBlocks(const exportBlueprintArgs& Args, const std::string& TempFolder, chunkBufferStruct* Input, int FileIndex, uint64_t* IndicesOffset, uint64_t* TexPosOffset); } #endif diff --git a/source/exporter/chunkHeader.cpp b/source/exporter/chunkHeader.cpp index 82e1cf6..2882764 100644 --- a/source/exporter/chunkHeader.cpp +++ b/source/exporter/chunkHeader.cpp @@ -42,11 +42,11 @@ bool sm2obj::loadChunkHeader(ffw::file* File, int* ChunkIndex, int* TotalChunks) auto& currentIndex = chunkIndex[x][y][z]; // Swap bytes due to endianness - currentIndex.chunkID = __builtin_bswap32(currentIndex.chunkID); - currentIndex.chunkLen = __builtin_bswap32(currentIndex.chunkLen); + currentIndex.chunkID = ffw::byteSwap32(currentIndex.chunkID); + currentIndex.chunkLen = ffw::byteSwap32(currentIndex.chunkLen); auto& currentStamp = timeStampIndex[z][y][x]; - currentStamp = __builtin_bswap64(currentStamp); + currentStamp = ffw::byteSwap64(currentStamp); if(currentIndex.chunkID >= 0){ (*TotalChunks)++; diff --git a/source/exporter/chunkLoader.cpp b/source/exporter/chunkLoader.cpp index 1535dcf..e90bb13 100644 --- a/source/exporter/chunkLoader.cpp +++ b/source/exporter/chunkLoader.cpp @@ -11,7 +11,7 @@ // Load chunk and decompress data ///============================================================================= -bool sm2obj::loadChunk(ffw::file* File, size_t FileOffset, int ChunkIndex, uint32_t ChunkData[][16][16], ffw::vec3i* Pos){ +bool sm2obj::loadChunk(const exportBlueprintArgs& Args, ffw::file* File, size_t FileOffset, int ChunkIndex, uint32_t ChunkData[][16][16], ffw::vec3i* Pos){ uint64_t timeStamp; int32_t relativePosition[3]; uint8_t chunkType; @@ -24,20 +24,20 @@ bool sm2obj::loadChunk(ffw::file* File, size_t FileOffset, int ChunkIndex, uint3 File->read(&chunkType, sizeof(uint8_t)) && File->read(&compressedDataLength, sizeof(uint32_t)) && File->read(&compressedData, 5095)) ){ - LOG_ERROR("Chunk error while reading chunk header!"); + Args.callbackLogError("Chunk error while reading chunk header!"); return false; } - timeStamp = __builtin_bswap64(timeStamp); - relativePosition[0] = __builtin_bswap32(relativePosition[0]); - relativePosition[1] = __builtin_bswap32(relativePosition[1]); - relativePosition[2] = __builtin_bswap32(relativePosition[2]); - compressedDataLength = __builtin_bswap32(compressedDataLength); + timeStamp = ffw::byteSwap64(timeStamp); + relativePosition[0] = ffw::byteSwap32(relativePosition[0]); + relativePosition[1] = ffw::byteSwap32(relativePosition[1]); + relativePosition[2] = ffw::byteSwap32(relativePosition[2]); + compressedDataLength = ffw::byteSwap32(compressedDataLength); if(relativePosition[0] > 9999 || relativePosition[0] < -9999 || relativePosition[1] > 9999 || relativePosition[1] < -9999 || relativePosition[2] > 9999 || relativePosition[2] < -9999){ - LOG_WARNING("Chunk error while reading chunk header! Wrong relative position!"); + Args.callbackLogWarning("Chunk error while reading chunk header! Wrong relative position!"); return false; } @@ -49,7 +49,7 @@ bool sm2obj::loadChunk(ffw::file* File, size_t FileOffset, int ChunkIndex, uint3 strm.next_in = Z_NULL; int ret = inflateInit(&strm); if(ret != Z_OK){ - LOG_WARNING("Chunk failed to load! Z-Lib init error!"); + Args.callbackLogWarning("Chunk failed to load! Z-Lib init error!"); inflateEnd(&strm); return false; } @@ -65,7 +65,7 @@ bool sm2obj::loadChunk(ffw::file* File, size_t FileOffset, int ChunkIndex, uint3 int have = (16*16*16*3) - strm.avail_out; if(have != 12288){ - LOG_WARNING("Can not decompress data! Chunk might be corrupted!"); + Args.callbackLogWarning("Can not decompress data! Chunk might be corrupted!"); return false; } diff --git a/source/exporter/chunkLoader.h b/source/exporter/chunkLoader.h index e6e5ac3..ffaf94c 100644 --- a/source/exporter/chunkLoader.h +++ b/source/exporter/chunkLoader.h @@ -8,9 +8,10 @@ #define SM2OBJ_CHUNK_LOADER #include +#include "config.h" namespace sm2obj{ - bool loadChunk(ffw::file* File, size_t FileOffset, int ChunkIndex, uint32_t ChunkData[][16][16], ffw::vec3i* Pos); + bool loadChunk(const exportBlueprintArgs& Args, ffw::file* File, size_t FileOffset, int ChunkIndex, uint32_t ChunkData[][16][16], ffw::vec3i* Pos); } #endif diff --git a/source/exporter/config.cpp b/source/exporter/config.cpp index 2e9384d..fb724e1 100644 --- a/source/exporter/config.cpp +++ b/source/exporter/config.cpp @@ -9,12 +9,7 @@ sm2obj::chunkBufferStruct sm2obj::chunkBufferA; sm2obj::chunkBufferStruct sm2obj::chunkBufferB; -std::string sm2obj::config::imageExtension; -sm2obj::config::imageSaver sm2obj::config::imageSaverFunc; -sm2obj::config::exportLogError sm2obj::config::exportLogErrorFunc; -sm2obj::config::exportLogInfo sm2obj::config::exportLogInfoFunc; -sm2obj::config::exportLogDebug sm2obj::config::exportLogDebugFunc; -sm2obj::config::exportProgress sm2obj::config::exportProgressFunc; -sm2obj::config::exportLogWarning sm2obj::config::exportLogWarningFunc; -sm2obj::config::exportExit sm2obj::config::exportExitFunc; - +bool sm2obj::stopExport = false; +void sm2obj::bruteforceExit(){ + stopExport = true; +} diff --git a/source/exporter/config.h b/source/exporter/config.h index 5d82b95..1ef8c43 100644 --- a/source/exporter/config.h +++ b/source/exporter/config.h @@ -8,38 +8,110 @@ #define SM2OBJ_CONFIG #include -#include "constants.h" -#include "structures.h" + +#define SM2OBJ_CHUNK_SIZE 16*16*16 +#define SM2OBJ_CHUNK_MAX_VERTICES 8 +#define SM2OBJ_CHUNK_MAX_INDICES 8 namespace sm2obj{ - extern chunkBufferStruct chunkBufferA; - extern chunkBufferStruct chunkBufferB; + struct exportBlueprintArgs { + std::string inputConfigFolder; + std::string inputFolder; + std::string outputFolder; + std::string outputName; + std::string textureExtension; + bool exportUV; + bool useAtlas; + bool exportMaterials; + bool exportDiffuse; + bool exportAlpha; + bool exportNormals; + bool exportEmissive; + bool specularHighlight; + int numOfThreads; + int width; + bool normalToBump; + bool exportAttachments; + bool (*imageSaver)(const std::string&, unsigned char*, int, int, ffw::imageType); + void (*callbackLogError)(const std::string& Message); + void (*callbackLogInfo)(const std::string& Message); + void (*callbackLogDebug)(const std::string& Message); + void (*callbackLogWarning)(const std::string& Message); + void (*callbackProgress)(int Progress, int Total); + void (*callbackTerminate)(bool Success); + }; + + struct chunkBufferStruct { + ffw::vec3f vertices [SM2OBJ_CHUNK_SIZE * SM2OBJ_CHUNK_MAX_VERTICES]; + ffw::vec4i indices [SM2OBJ_CHUNK_SIZE * SM2OBJ_CHUNK_MAX_INDICES]; + ffw::vec4i indicesUvs[SM2OBJ_CHUNK_SIZE * SM2OBJ_CHUNK_MAX_INDICES]; + uint16_t indicesMat [SM2OBJ_CHUNK_SIZE * SM2OBJ_CHUNK_MAX_INDICES][3]; + uint32_t indicesCount; + uint32_t verticesCount; + uint32_t indicesOffset; + std::vector extractedMaterialsList; + }; + + // Information about chunks + struct chunkInfoStruct { + // Relative position + ffw::vec3i pos; + // Relative position of the file from which chunk was loaded + ffw::vec3i posFile; + // Index of the file + int fileIndex; + }; - namespace config { - // Pointer to image saving function - // Use one of these: - // imageSaver = &ffw::saveBMP; - // imageSaver = &ffw::savePNG; - // imageSaver = &ffw::saveTGA; - // imageSaver = &ffw::saveTIFF; - extern std::string imageExtension; - - typedef bool (*imageSaver)(const std::string& Path, unsigned char* Pixels, int Width, int Height, ffw::imageType Type); - typedef void (*exportLogError)(const std::string& Message); - typedef void (*exportLogInfo)(const std::string& Message); - typedef void (*exportLogDebug)(const std::string& Message); - typedef void (*exportLogWarning)(const std::string& Message); - typedef void (*exportProgress)(int Progress, int Total); - typedef void (*exportExit)(bool Success); - - extern imageSaver imageSaverFunc; - extern exportLogError exportLogErrorFunc; - extern exportLogInfo exportLogInfoFunc; - extern exportLogDebug exportLogDebugFunc; - extern exportProgress exportProgressFunc; - extern exportLogWarning exportLogWarningFunc; - extern exportExit exportExitFunc; + // Information about entity + struct entityInfoStruct { + // Name + std::string name; + // Relative path + std::string path; + // Position of docking in parent space + ffw::vec3f pos; + // Orientation of docking + ffw::quaternion orientation; + // Position of dock module in local space + ffw::vec3f dockModule; + // Dock offset in local space + ffw::vec3f dockOffset; + // Attached ships and turrets + std::vector attachments; + // Chunk information + std::vector chunks; + // Extracted tiles + std::vector extractedTiles; + // Extracted tiles + std::vector extractedMaterials; + // Parent pointer + entityInfoStruct* parent; }; + + // Information about thread + struct threadInfoStruct { + // Path to raw chunks + std::string tempFolder; + // Main thread class + ffw::thread thread; + // Lock mutex + ffw::mutex mut; + // Chunk information that is beeing processed by thread + sm2obj::chunkInfoStruct* chunkPtr; + // Buffers to save chunk data + sm2obj::chunkBufferStruct chunkBufferA; + sm2obj::chunkBufferStruct chunkBufferB; + // Pointer to the entity + sm2obj::entityInfoStruct* entityPtr; + + sm2obj::exportBlueprintArgs Args; + }; + + extern chunkBufferStruct chunkBufferA; + extern chunkBufferStruct chunkBufferB; + extern bool stopExport; + + void bruteforceExit(); }; #endif diff --git a/source/exporter/constants.h b/source/exporter/constants.h deleted file mode 100644 index d00201d..0000000 --- a/source/exporter/constants.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -* This file is part of SM2OBJ project. -* Copyright (C) 2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#define SM2OBJ_CHUNK_SIZE 16*16*16 -#define SM2OBJ_CHUNK_MAX_VERTICES 8 -#define SM2OBJ_CHUNK_MAX_INDICES 8 - -#define TERMINATE(X)\ -sm2obj::config::exportExitFunc(X); return X; - -#define LOG_DEBUG(X)\ -sm2obj::config::exportLogDebugFunc(X); - -#define LOG_ERROR(X)\ -sm2obj::config::exportLogErrorFunc(X); - -#define LOG_INFO(X)\ -sm2obj::config::exportLogInfoFunc(X); - -#define LOG_WARNING(X)\ -sm2obj::config::exportLogWarningFunc(X); - -#define PROGRESS(X, Y)\ -sm2obj::config::exportProgressFunc(X, Y); diff --git a/source/exporter/exportBlueprint.cpp b/source/exporter/exportBlueprint.cpp index 0c8a169..5072578 100644 --- a/source/exporter/exportBlueprint.cpp +++ b/source/exporter/exportBlueprint.cpp @@ -19,25 +19,22 @@ #include "blockVerticeData.h" #include "materialExport.h" -static bool recursiveMetaLoader(sm2obj::entityInfoStruct* Output, const std::string& InputFolder, const std::string& SubFolder, const std::string& OutputName); -static void recursiveMetaDump(sm2obj::entityInfoStruct* Output, int Indent); -static bool recursiveChunkLoader(sm2obj::entityInfoStruct* Input, const std::string& InputFolder, const std::string& OutputTemp, int& FileIndex); -static void recursiveChunkExport(sm2obj::entityInfoStruct* Input, const std::string& InputOutputTemp, sm2obj::threadInfoStruct* Threads, int NumOfThreads, int& Progress, int ProgressTotal); -static bool mergeVertices(sm2obj::entityInfoStruct* Input, const std::string& InputOutputTemp, ffw::file* Output, bool SplitTextures, bool ExportUvMaps); -static void generateEntityQueue(sm2obj::entityInfoStruct* Input, std::vector* Output); +static bool recursiveMetaLoader(const sm2obj::exportBlueprintArgs& Args, sm2obj::entityInfoStruct* Output, const std::string& SubFolder); +static void recursiveMetaDump(const sm2obj::exportBlueprintArgs& Args, sm2obj::entityInfoStruct* Output, int Indent); +static bool recursiveChunkLoader(const sm2obj::exportBlueprintArgs& Args, sm2obj::entityInfoStruct* Input, const std::string& OutputTemp, int& FileIndex); +static void recursiveChunkExport(const sm2obj::exportBlueprintArgs& Args, sm2obj::entityInfoStruct* Input, const std::string& InputOutputTemp, sm2obj::threadInfoStruct* Threads, int& Progress, int ProgressTotal); +static bool mergeVertices(const sm2obj::exportBlueprintArgs& Args, sm2obj::entityInfoStruct* Input, const std::string& InputOutputTemp, ffw::file* Output, bool SplitTextures, bool ExportUvMaps); +static void generateEntityQueue(const sm2obj::exportBlueprintArgs& Args, sm2obj::entityInfoStruct* Input, std::vector* Output); static void* processChunk(void* ThreadInfoPtr); ///============================================================================= -bool sm2obj::exportBlueprint(const std::string& InputConfigFolder, const std::string& InputFolder, - const std::string& OutputFolder, const std::string& OutputName, - bool ExportUV, bool UseAtlas, bool ExportMaterials, - bool ExportDiffuse, bool ExportAlpha, bool ExportNormals, bool ExportEmissive, - bool SpecularHighlight, int NumOfThreads, bool ExportAttachments){ - clearBlockConfig(); +bool sm2obj::exportBlueprint(const exportBlueprintArgs& Args){ + std::cout << ">>> exportBlueprint" << std::endl; + clearBlockConfig(); ffw::file objOutput; ffw::file mtlOutput; entityInfoStruct entityRoot; - entityRoot.name = OutputName; + entityRoot.name = Args.outputName; entityRoot.path = ""; entityRoot.pos.set(8.0f, 8.0f, 8.0f); entityRoot.dockModule.set(8.0f, 8.0f, 8.0f); @@ -46,115 +43,124 @@ bool sm2obj::exportBlueprint(const std::string& InputConfigFolder, const std::st threadInfoStruct* threads; // Load block types - if(!loadBlockTypes(InputConfigFolder + "\\BlockTypes.properties")){ - TERMINATE(false); + if(!loadBlockTypes(Args, Args.inputConfigFolder + "\\BlockTypes.properties")){ + Args.callbackTerminate(false); return false; } // Load block config - if(!loadBlockConfig(InputConfigFolder + "\\BlockConfig.xml")){ - TERMINATE(false); + if(!loadBlockConfig(Args, Args.inputConfigFolder + "\\BlockConfig.xml")){ + Args.callbackTerminate(false); return false; } // Open OBJ file for wirting - if(!objOutput.open(OutputFolder + "\\" + OutputName + ".obj", false, true, true)){ - LOG_ERROR("Failed to open OBJ file for writing! Make sure the path: " + OutputFolder + " is valid!"); - TERMINATE(false); + if(!objOutput.open(Args.outputFolder + "\\" + Args.outputName + ".obj", false, true, true)){ + Args.callbackLogError("Failed to open OBJ file for writing! Make sure the path: " + Args.outputFolder + " is valid!"); + Args.callbackTerminate(false); return false; } // Open MTL file for writing - if(!mtlOutput.open(OutputFolder + "\\" + OutputName + ".mtl", false, true, true)){ - LOG_ERROR("Failed to open MTL file for writing! Make sure the path: " + OutputFolder + " is valid!"); - TERMINATE(false); + if(!mtlOutput.open(Args.outputFolder + "\\" + Args.outputName + ".mtl", false, true, true)){ + Args.callbackLogError("Failed to open MTL file for writing! Make sure the path: " + Args.outputFolder + " is valid!"); + Args.callbackTerminate(false); return false; } // Load all attachments - if(ExportAttachments){ - LOG_INFO("Loading attached ships and turrets..."); - if(!recursiveMetaLoader(&entityRoot, InputFolder, "", OutputName)){ - TERMINATE(false); + if(Args.exportAttachments){ + Args.callbackLogInfo("Loading attached ships and turrets..."); + if(!recursiveMetaLoader(Args, &entityRoot, "")){ + Args.callbackTerminate(false); return false; } } // Dump information about attachments - LOG_DEBUG("Blueprint root:"); - recursiveMetaDump(&entityRoot, 0); + Args.callbackLogDebug("Blueprint root:"); + recursiveMetaDump(Args, &entityRoot, 0); std::string tempFolder = ffw::getExecutablePath() + "\\temp"; // Load chunk headers and export decompressed chunks to temp folder - LOG_INFO("Loading chunks..."); + Args.callbackLogInfo("Loading chunks..."); int fileIndex = 0; ffw::createDirectory(tempFolder); - if(!recursiveChunkLoader(&entityRoot, InputFolder, ffw::getExecutablePath() + "\\temp", fileIndex)){ - TERMINATE(false); + if(!recursiveChunkLoader(Args, &entityRoot, ffw::getExecutablePath() + "\\temp", fileIndex)){ + Args.callbackTerminate(false); return false; } // Create threads - threads = new threadInfoStruct[NumOfThreads]; - for(int i = 0; i < NumOfThreads; i++){ + threads = new threadInfoStruct[Args.numOfThreads]; + for(int i = 0; i < Args.numOfThreads; i++){ threads[i].thread.bindFunction(&processChunk); } // Export chunks int progress = 0; int progressTotal = fileIndex; - recursiveChunkExport(&entityRoot, tempFolder, threads, NumOfThreads, progress, progressTotal); + recursiveChunkExport(Args, &entityRoot, tempFolder, threads, progress, progressTotal); // Delete threads delete[] threads; + if(stopExport)return false; // Generate queue std::vector entityQueue; - generateEntityQueue(&entityRoot, &entityQueue); + generateEntityQueue(Args, &entityRoot, &entityQueue); + + if(stopExport)return false; // Export vertices progress = 0; uint64_t indicesOffset = 0; uint64_t texPosOffset = 0; - sm2obj::chunkBufferStruct chunkRawBuffer; - //recursiveVerticesExport(&entityRoot, tempFolder, progress, progressTotal, ExportMaterials, !UseAtlas, ExportUV, &totalExportedIndices); + sm2obj::chunkBufferStruct* chunkRawBuffer = new sm2obj::chunkBufferStruct; + + //recursiveVerticesExport(&entityRoot, tempFolder, progress, progressTotal, Args.exportMaterials, !Args.useAtlas, Args.exportUV, &totalExportedIndices); for(auto& entity : entityQueue){ - chunkRawBuffer.extractedMaterialsList.clear(); + chunkRawBuffer->extractedMaterialsList.clear(); for(auto& chunk : entity->chunks){ progress++; - LOG_INFO("Generating vertices: " + ffw::valToString(progress) + " out of: " + ffw::valToString(progressTotal)); - PROGRESS(progress, progressTotal); + Args.callbackLogInfo("Generating vertices: " + ffw::valToString(progress) + " out of: " + ffw::valToString(progressTotal)); + Args.callbackProgress(progress, progressTotal); // Load a temp block to memory - sm2obj::loadRawBlocks(tempFolder, &chunkRawBuffer, chunk.fileIndex); + sm2obj::loadRawBlocks(Args, tempFolder, chunkRawBuffer, chunk.fileIndex); // Export block block to temp as indices and vertices - sm2obj::extractBlocks(tempFolder, &chunkRawBuffer, chunk.fileIndex, ExportMaterials, !UseAtlas, ExportUV, &indicesOffset, &texPosOffset); + sm2obj::extractBlocks(Args, tempFolder, chunkRawBuffer, chunk.fileIndex, &indicesOffset, &texPosOffset); } - if(!UseAtlas)texPosOffset += 4; - else texPosOffset += chunkRawBuffer.extractedMaterialsList.size()*4; + if(!Args.useAtlas)texPosOffset += 4; + else texPosOffset += chunkRawBuffer->extractedMaterialsList.size()*4; - if(UseAtlas){ - for(auto i : chunkRawBuffer.extractedMaterialsList)entity->extractedTiles.push_back(i.x); + if(Args.useAtlas){ + for(auto i : chunkRawBuffer->extractedMaterialsList)entity->extractedTiles.push_back(i.x); } else { - for(auto i : chunkRawBuffer.extractedMaterialsList)entity->extractedMaterials.push_back(i); + for(auto i : chunkRawBuffer->extractedMaterialsList)entity->extractedMaterials.push_back(i); } } + delete chunkRawBuffer; + + if(stopExport)return false; // Merge files - LOG_INFO("Merging vertices and indices into a single file..."); + Args.callbackLogInfo("Merging vertices and indices into a single file..."); objOutput.writeLine("# SM2OBJ"); - if(ExportMaterials)objOutput.writeLine("mtllib " + OutputName + ".mtl"); + if(Args.exportMaterials)objOutput.writeLine("mtllib " + Args.outputName + ".mtl"); - //recursiveVerticesMerge(&entityRoot, tempFolder, &objOutput, !UseAtlas, ExportUV); + //recursiveVerticesMerge(&entityRoot, tempFolder, &objOutput, !Args.useAtlas, Args.exportUV); for(auto& entity : entityQueue){ - mergeVertices(entity, tempFolder, &objOutput, !UseAtlas, ExportUV); + mergeVertices(Args, entity, tempFolder, &objOutput, !Args.useAtlas, Args.exportUV); } - LOG_INFO("Creating material file..."); + if(stopExport)return false; + + Args.callbackLogInfo("Creating material file..."); // Export materials - if(ExportMaterials && UseAtlas){ - LOG_DEBUG("Exporting altas materials"); - LOG_DEBUG("Creating 3 materials..."); - createMaterialAtlas(&mtlOutput, ExportDiffuse, ExportNormals, ExportAlpha, ExportEmissive, SpecularHighlight); - } else if(ExportMaterials){ - LOG_DEBUG("Exporting block materials"); + if(Args.exportMaterials && Args.useAtlas){ + Args.callbackLogDebug("Exporting altas materials"); + Args.callbackLogDebug("Creating 3 materials..."); + createMaterialAtlas(Args, &mtlOutput); + } else if(Args.exportMaterials){ + Args.callbackLogDebug("Exporting block materials"); std::vector materialList; for(auto& entity : entityQueue){ @@ -173,27 +179,28 @@ bool sm2obj::exportBlueprint(const std::string& InputConfigFolder, const std::st } } - LOG_DEBUG("Creating " + ffw::valToString(materialList.size()) + " materials..."); + Args.callbackLogDebug("Creating " + ffw::valToString(materialList.size()) + " materials..."); mtlOutput.writeLine("# SM2OBJ\n"); for(auto& mat : materialList){ const blockInfoStruct* block = findBlock(mat.x); if(block == NULL)continue; - createMaterialTile(&mtlOutput, block, mat.y, ExportDiffuse, ExportNormals, ExportAlpha, ExportEmissive, SpecularHighlight); + createMaterialTile(Args, &mtlOutput, block, mat.y); } } - TERMINATE(true); + Args.callbackTerminate(true); + return true; } ///============================================================================= -bool recursiveMetaLoader(sm2obj::entityInfoStruct* Output, const std::string& InputFolder, const std::string& SubFolder, const std::string& OutputName){ - if(!loadMeta(Output, InputFolder + SubFolder + "\\meta.smbpm", OutputName)){ +bool recursiveMetaLoader(const sm2obj::exportBlueprintArgs& Args, sm2obj::entityInfoStruct* Output, const std::string& SubFolder){ + if(!loadMeta(Args, Output, Args.inputFolder + SubFolder + "\\meta.smbpm", Args.outputName)){ return false; } for(auto& item : Output->attachments){ - if(!recursiveMetaLoader(&item, InputFolder, "\\" + item.path, OutputName)){ + if(!recursiveMetaLoader(Args, &item, "\\" + item.path)){ return false; } } @@ -202,31 +209,33 @@ bool recursiveMetaLoader(sm2obj::entityInfoStruct* Output, const std::string& In } ///============================================================================= -void recursiveMetaDump(sm2obj::entityInfoStruct* Output, int Indent){ +void recursiveMetaDump(const sm2obj::exportBlueprintArgs& Args, sm2obj::entityInfoStruct* Output, int Indent){ std::string ind; ind.resize(Indent, ' '); - LOG_DEBUG(ind + "> Name: " + Output->name); - LOG_DEBUG(ind + "> Path: " + Output->path); - //LOG_DEBUG(ind + "> Position: " + ffw::valToString(Output->pos.x) + ", " + ffw::valToString(Output->pos.y) + ", " + ffw::valToString(Output->pos.z)); - //LOG_DEBUG(ind + "> Orientation: " + ffw::valToString(Output->orientation.x) + ", " + ffw::valToString(Output->orientation.y) + ", " + ffw::valToString(Output->orientation.z)); - LOG_DEBUG(ind + "> Dock module position: " + ffw::valToString(Output->dockModule.x) + ", " + ffw::valToString(Output->dockModule.y) + ", " + ffw::valToString(Output->dockModule.z)); + Args.callbackLogDebug(ind + "> Name: " + Output->name); + Args.callbackLogDebug(ind + "> Path: " + Output->path); + //Args.callbackLogDebug(ind + "> Position: " + ffw::valToString(Output->pos.x) + ", " + ffw::valToString(Output->pos.y) + ", " + ffw::valToString(Output->pos.z)); + //Args.callbackLogDebug(ind + "> Orientation: " + ffw::valToString(Output->orientation.x) + ", " + ffw::valToString(Output->orientation.y) + ", " + ffw::valToString(Output->orientation.z)); + Args.callbackLogDebug(ind + "> Dock module position: " + ffw::valToString(Output->dockModule.x) + ", " + ffw::valToString(Output->dockModule.y) + ", " + ffw::valToString(Output->dockModule.z)); for(auto& item : Output->attachments){ - recursiveMetaDump(&item, Indent+2); + recursiveMetaDump(Args, &item, Indent+2); } } ///============================================================================= -bool recursiveChunkLoader(sm2obj::entityInfoStruct* Input, const std::string& InputFolder, const std::string& OutputTemp, int& FileIndex){ +bool recursiveChunkLoader(const sm2obj::exportBlueprintArgs& Args, sm2obj::entityInfoStruct* Input, const std::string& OutputTemp, int& FileIndex){ std::vector allFiles; // Open target directory ffw::directory dir; - if(!dir.open(InputFolder + Input->path + "\\DATA")){ - LOG_ERROR("Failed to open folder: " + InputFolder + "\\" + Input->path + " The program might not have permission to do it!"); + if(!dir.open(Args.inputFolder + Input->path + "\\DATA")){ + Args.callbackLogError("Failed to open folder: " + Args.inputFolder + "\\" + Input->path + " The program might not have permission to do it!"); return false; } + if(sm2obj::stopExport)return false; + // Include all files that match for(const auto& file : dir.getFiles()){ std::string extension; @@ -236,23 +245,26 @@ bool recursiveChunkLoader(sm2obj::entityInfoStruct* Input, const std::string& In allFiles.push_back(file); } + if(sm2obj::stopExport)return false; + // Load all files for(const auto& file : allFiles){ + if(sm2obj::stopExport)return false; ffw::file fileInput; - LOG_DEBUG("Reading file: " + file); + Args.callbackLogDebug("Reading file: " + file); // Get file position from file name size_t pos = file.find('.'); if(pos == std::string::npos){ - LOG_ERROR("Error while retrieving file position from file name! Expected dot with coordinates!"); + Args.callbackLogError("Error while retrieving file position from file name! Expected dot with coordinates!"); return false; } // Get position as tokens std::vector tokens = ffw::getTokens(file.substr(pos+1, file.size()-pos-6), '.'); if(tokens.size() != 3){ - LOG_ERROR("Error while retrieving file position from file name! Wrong coordinates!"); + Args.callbackLogError("Error while retrieving file position from file name! Wrong coordinates!"); return false; } @@ -263,24 +275,24 @@ bool recursiveChunkLoader(sm2obj::entityInfoStruct* Input, const std::string& In filePos.y = ffw::stringToVal(tokens[1]); filePos.z = ffw::stringToVal(tokens[2]); filePos *= 256; - } catch (std::exception& e){ - LOG_ERROR("Error while retrieving file position from file name! Wrong coordinates!"); + } catch (std::exception e){ + Args.callbackLogError("Error while retrieving file position from file name! Wrong coordinates!"); return false; } // Print file position - LOG_DEBUG("File position: " + tokens[0] + ", " + tokens[1] + ", " + tokens[2]); + Args.callbackLogDebug("File position: " + tokens[0] + ", " + tokens[1] + ", " + tokens[2]); // Open a file - if(!fileInput.open(InputFolder + Input->path + "\\DATA\\" + file, true, false, false)){ - LOG_ERROR("Failed to open file: " + InputFolder + Input->path + "\\DATA\\" + file); + if(!fileInput.open(Args.inputFolder + Input->path + "\\DATA\\" + file, true, false, false)){ + Args.callbackLogError("Failed to open file: " + Args.inputFolder + Input->path + "\\DATA\\" + file); return false;\ } // Check if file is big enough to contain header size_t fileSize = fileInput.getSize(); if(fileSize < size_t(4+32768+16384)){ - LOG_ERROR("File is invalid! File is too small. Expected at least 49156 bytes."); + Args.callbackLogError("File is invalid! File is too small. Expected at least 49156 bytes."); return false; } @@ -295,7 +307,7 @@ bool recursiveChunkLoader(sm2obj::entityInfoStruct* Input, const std::string& In // Remember the file offset size_t fileOffset = fileInput.getPos(); - LOG_DEBUG("Total chunks: " + ffw::valToString(totalChunks)); + Args.callbackLogDebug("Total chunks: " + ffw::valToString(totalChunks)); //fileChunksTotal += totalChunks; // Sort indexes @@ -306,18 +318,19 @@ bool recursiveChunkLoader(sm2obj::entityInfoStruct* Input, const std::string& In uint32_t chunkData[16][16][16]; ffw::vec3i chunkPos; for(int i = 0; i < SM2OBJ_CHUNK_SIZE; i++){ + if(sm2obj::stopExport)return false; if(chunkIndex[i] < 0)continue; - LOG_DEBUG("Loading chunk index: " + ffw::valToString(chunkIndex[i])); + Args.callbackLogDebug("Loading chunk index: " + ffw::valToString(chunkIndex[i])); // Load chunk fileInput.gotoPos(fileOffset + chunkIndex[i]*5120); - if(!sm2obj::loadChunk(&fileInput, fileOffset, chunkIndex[i], chunkData, &chunkPos)){ + if(!sm2obj::loadChunk(Args, &fileInput, fileOffset, chunkIndex[i], chunkData, &chunkPos)){ continue; } // Save decompressed raw chunk data to temp folder if(!sm2obj::saveTempChunk(OutputTemp, FileIndex, &chunkData[0][0][0])){ - LOG_WARNING("Error while saving chunk to temp! Make sure the program has permissions to create files!"); + Args.callbackLogWarning("Error while saving chunk to temp! Make sure the program has permissions to create files!"); continue; } @@ -326,32 +339,35 @@ bool recursiveChunkLoader(sm2obj::entityInfoStruct* Input, const std::string& In FileIndex++; } } + if(sm2obj::stopExport)return false; for(auto& item : Input->attachments){ - if(!recursiveChunkLoader(&item, InputFolder, OutputTemp, FileIndex))return false; + if(sm2obj::stopExport)return false; + if(!recursiveChunkLoader(Args, &item, OutputTemp, FileIndex))return false; } return true; } ///============================================================================= -void recursiveChunkExport(sm2obj::entityInfoStruct* Input, const std::string& InputOutputTemp, sm2obj::threadInfoStruct* Threads, int NumOfThreads, int& Progress, int ProgressTotal){ - LOG_DEBUG("Exporting: " + Input->name + " from: " + Input->path); +void recursiveChunkExport(const sm2obj::exportBlueprintArgs& Args, sm2obj::entityInfoStruct* Input, const std::string& InputOutputTemp, sm2obj::threadInfoStruct* Threads, int& Progress, int ProgressTotal){ + Args.callbackLogDebug("Exporting: " + Input->name + " from: " + Input->path); // export chunks one by one for(auto& chunk : Input->chunks){ + if(sm2obj::stopExport)break; // Find an empty thread while(true){ bool found = false; // Loop through all threads - for(int i = 0; i < NumOfThreads; i++){ + for(int i = 0; i < Args.numOfThreads; i++){ // We can lock a thread only of it has finished if(Threads[i].mut.tryLock()){ // We found an empty thread, bind information and run it Progress++; //progress(processedChunks, fileChunksTotal); - LOG_INFO("Processing chunk: " + ffw::valToString(Progress) + " out of: " + ffw::valToString(ProgressTotal)); - PROGRESS(Progress, ProgressTotal); + Args.callbackLogInfo("Processing chunk: " + ffw::valToString(Progress) + " out of: " + ffw::valToString(ProgressTotal)); + Args.callbackProgress(Progress, ProgressTotal); // Where are raw chunks stored Threads[i].tempFolder = InputOutputTemp; // Unlock mutex @@ -362,6 +378,8 @@ void recursiveChunkExport(sm2obj::entityInfoStruct* Input, const std::string& In Threads[i].chunkPtr = &chunk; // Set matrix Threads[i].entityPtr = Input; + // Copy arguments + Threads[i].Args = Args; // Start Threads[i].thread.start(&Threads[i]); // Wait 100ms and go to next chunk @@ -376,17 +394,19 @@ void recursiveChunkExport(sm2obj::entityInfoStruct* Input, const std::string& In } } - LOG_DEBUG("Waiting for threads..."); + Args.callbackLogDebug("Waiting for threads..."); // Join all threads - for(int i = 0; i < NumOfThreads; i++){ + for(int i = 0; i < Args.numOfThreads; i++){ Threads[i].thread.join(); } for(auto& item : Input->attachments){ - recursiveChunkExport(&item, InputOutputTemp, Threads, NumOfThreads, Progress, ProgressTotal); + if(sm2obj::stopExport)break; + recursiveChunkExport(Args, &item, InputOutputTemp, Threads, Progress, ProgressTotal); } } +///============================================================================= void constructRotation(sm2obj::entityInfoStruct* Parent, ffw::mat4* Matrix){ while(Parent != NULL){ Matrix->rotate(Parent->orientation); @@ -406,7 +426,7 @@ void* processChunk(void* ThreadInfoPtr){ // Load chunk from file uint32_t chunkData[16][16][16]; if(!sm2obj::loadTempChunk(threadInfo->tempFolder, chunk->fileIndex, &chunkData[0][0][0])){ - LOG_WARNING("Error loading chunk file index: " + ffw::valToString(chunk->fileIndex)); + threadInfo->Args.callbackLogWarning("Error loading chunk file index: " + ffw::valToString(chunk->fileIndex)); threadInfo->mut.unlock(); return NULL; } @@ -423,7 +443,7 @@ void* processChunk(void* ThreadInfoPtr){ for(posRel.x = 0; posRel.x < 16; posRel.x++){ if(chunkData[posRel.z][posRel.y][posRel.x] == 0)continue; - buildBlock(posRel, chunk->pos, chunk->posFile, chunkData, &threadInfo->chunkBufferA); + buildBlock(threadInfo->Args, posRel, chunk->pos, chunk->posFile, chunkData, &threadInfo->chunkBufferA); } } } @@ -536,9 +556,9 @@ void* processChunk(void* ThreadInfoPtr){ // Now the data is in buffer A // Save it to temp file - saveRawBlocks(threadInfo->tempFolder, &threadInfo->chunkBufferA, chunk->fileIndex); + saveRawBlocks(threadInfo->Args, threadInfo->tempFolder, &threadInfo->chunkBufferA, chunk->fileIndex); - LOG_DEBUG("Chunk index: " + ffw::valToString(chunk->fileIndex) + " exported!"); + threadInfo->Args.callbackLogDebug("Chunk index: " + ffw::valToString(chunk->fileIndex) + " exported!"); // Unlock this thread threadInfo->mut.unlock(); @@ -546,16 +566,16 @@ void* processChunk(void* ThreadInfoPtr){ } ///============================================================================= -void generateEntityQueue(sm2obj::entityInfoStruct* Input, std::vector* Output){ +void generateEntityQueue(const sm2obj::exportBlueprintArgs& Args, sm2obj::entityInfoStruct* Input, std::vector* Output){ Output->push_back(Input); for(auto& item : Input->attachments){ - generateEntityQueue(&item, Output); + generateEntityQueue(Args, &item, Output); } } ///============================================================================= -bool mergeVertices(sm2obj::entityInfoStruct* Input, const std::string& InputOutputTemp, ffw::file* Output, bool SplitTextures, bool ExportUvMaps){ +bool mergeVertices(const sm2obj::exportBlueprintArgs& Args, sm2obj::entityInfoStruct* Input, const std::string& InputOutputTemp, ffw::file* Output, bool SplitTextures, bool ExportUvMaps){ Output->writeLine("o " + Input->name); for(auto& chunk : Input->chunks){ @@ -563,7 +583,7 @@ bool mergeVertices(sm2obj::entityInfoStruct* Input, const std::string& InputOutp // Open chunk temp file which contains vertices if(!vertices.open(InputOutputTemp + "\\chunk-temp-" + ffw::valToString(chunk.fileIndex) + ".vertices", false, false, false)){ - LOG_ERROR("Error failed to open vertex temp data! Index: " + ffw::valToString(chunk.fileIndex)); + Args.callbackLogError("Error failed to open vertex temp data! Index: " + ffw::valToString(chunk.fileIndex)); return false; } @@ -575,6 +595,7 @@ bool mergeVertices(sm2obj::entityInfoStruct* Input, const std::string& InputOutp Output->writeLine(temp); } } + if(sm2obj::stopExport)return false; // Export UVs if(ExportUvMaps && SplitTextures){ @@ -598,6 +619,7 @@ bool mergeVertices(sm2obj::entityInfoStruct* Input, const std::string& InputOutp } } } + if(sm2obj::stopExport)return false; // Shading off Output->writeLine("s off"); @@ -608,7 +630,7 @@ bool mergeVertices(sm2obj::entityInfoStruct* Input, const std::string& InputOutp // Open chunk temp file which contains indices if(!indices.open(InputOutputTemp + "\\chunk-temp-" + ffw::valToString(chunk.fileIndex) + ".indices", false, false, false)){ - LOG_ERROR("Error failed to open indice temp data! Index: " + ffw::valToString(chunk.fileIndex)); + Args.callbackLogError("Error failed to open indice temp data! Index: " + ffw::valToString(chunk.fileIndex)); return false; } @@ -623,525 +645,3 @@ bool mergeVertices(sm2obj::entityInfoStruct* Input, const std::string& InputOutp return true; } - -/*#include "blockConfig.h" -#include "chunkHeader.h" -#include "chunkLoader.h" -#include "chunkTempLoader.h" -#include "config.h" -#include "blockConstructor.h" -#include "blockExtractor.h" -#include "polygonFiltering.h" -#include "textureExport.h" -#include "materialExport.h" -#include "blockVerticeData.h" - -#define TERMINATE(X)\ -if(exportExitFunc != NULL)exportExitFunc(X); return (void*)X; - -static ffw::vec3i boundingBoxMin; -static ffw::vec3i boundingBoxMax; -static int fileChunksTotal = 0; -static int processedChunks = 0; -static std::string executablePath; - -// Information about chunks -struct chunkInfoStruct { - // Relative position - ffw::vec3i pos; - // Relative position of the file from which chunk was loaded - ffw::vec3i posFile; - // Index of the chunk - int index; - // Index of the file - int indexFile; -}; - -// Information about thread -struct threadInfoStruct { - // Main thread class - ffw::thread thread; - // Lock mutex - ffw::mutex mut; - // Chunk information that is beeing processed by thread - chunkInfoStruct* chunkPtr; - // Buffers to save chunk data - chunkBufferStruct chunkBufferA; - chunkBufferStruct chunkBufferB; -}; - -static threadInfoStruct* threads; -static std::vector chunkInfo; - -///============================================================================= -void progress(int Value, int Range){ - if(exportProgressFunc != NULL)exportProgressFunc(Value, Range); -} - -///============================================================================= -void* processChunk(void* ThreadInfoPtr){ - // Get pointer to the thread info struct - threadInfoStruct* threadInfo = static_cast(ThreadInfoPtr); - // Lock this thread - threadInfo->mut.lock(); - // Get chunk pointer - chunkInfoStruct* chunk = threadInfo->chunkPtr; - - // Load chunk from file - uint32_t chunkData[16][16][16]; - if(!loadTempChunk(executablePath, chunk->index, chunk->indexFile, &chunkData[0][0][0])){ - ffw::logger().error() << "Error loading chunk index: " << chunk->index << " file: " << chunk->indexFile; - threadInfo->mut.unlock(); - return NULL; - } - - // Reset buffer A - threadInfo->chunkBufferA.indicesCount = 0; - threadInfo->chunkBufferA.verticesCount = 0; - threadInfo->chunkBufferA.indicesOffset = 0; - - // Build blocks by looking through all XYZ positions in chunk - ffw::vec3i posRel; - for(posRel.z = 0; posRel.z < 16; posRel.z++){ - for(posRel.y = 0; posRel.y < 16; posRel.y++){ - for(posRel.x = 0; posRel.x < 16; posRel.x++){ - if(chunkData[posRel.z][posRel.y][posRel.x] == 0)continue; - - buildBlock(posRel, chunk->pos, chunk->posFile, chunkData, &threadInfo->chunkBufferA); - } - } - } - - // Reset buffer B - threadInfo->chunkBufferB.indicesCount = 0; - threadInfo->chunkBufferB.verticesCount = 0; - threadInfo->chunkBufferB.indicesOffset = 0; - - // Filter polygons that occupies same space - removeDuplicatedFaces(&threadInfo->chunkBufferA, &threadInfo->chunkBufferB); - - // Now the data is in buffer B - // We will use buffer A as a output - threadInfo->chunkBufferA.indicesCount = 0; - threadInfo->chunkBufferA.verticesCount = 0; - threadInfo->chunkBufferA.indicesOffset = 0; - - // Remove duplicated vertices - removeDuplicatedVertices(&threadInfo->chunkBufferB, &threadInfo->chunkBufferA); - - // Now the data is in buffer A - // Save it to temp file - saveRawBlocks(executablePath, &threadInfo->chunkBufferA, chunk->index, chunk->indexFile); - - ffw::logger().debug() << "Chunk: " << chunk->index << " file: " << chunk->indexFile << " exported!"; - - // Unlock this thread - threadInfo->mut.unlock(); - return NULL; -} - -///============================================================================= -void* runExporter(void* DATA){ - chunkInfo.clear(); - fileChunksTotal = 0; - - // Initialize logger - ffw::logger::initLogger(); - - ffw::logger().print() << "Starting exporter..."; - - // Get executable path - executablePath = ffw::getExecutablePath(); - - // Check if there is a job to do - if(!textureExport && filePath.size() == 0){ - ffw::logger().error() << "Nothing to do..."; - TERMINATE(false); - } - - // Check if path to StarMade data folder is not empty - if(starMadeDataFolder.size() == 0){ - ffw::logger().error() << "Wrong StarMade data folder! Have you missed something?"; - TERMINATE(false); - } - - // Check if target file is not empty - if(filePath.size() == 0){ - ffw::logger().error() << "Wrong file name! Have you missed something?"; - TERMINATE(false); - } - - // Check if output file name is not empty - if(fileName.size() == 0){ - ffw::logger().error() << "Wrong file name! Have you missed something?"; - TERMINATE(false); - } - - // Check if file exists - if(!ffw::checkIfFileExists(filePath)){ - ffw::logger().error() << "Invalid path to blueprint! Maybe the program does not have permissions..."; - TERMINATE(false); - } - - // Separate path to folder, name, and to extension - std::string blueprintFolder; - std::string blueprintName; - std::string blueprintExtension; - ffw::getFilePathProperties(filePath, &blueprintFolder, &blueprintName, &blueprintExtension); - - // Get frist part of the blueprint file name - // this: "Isanth Type-Zero Mb.0.0.0" becames this: "Isanth Type-Zero Mb" - std::string blueprintNameShort; - size_t dot = blueprintName.find('.'); - if(dot == std::string::npos){ - ffw::logger().error() << "Selected file has invalid name..."; - TERMINATE(false); - } else { - blueprintNameShort = blueprintName.substr(0, dot); - } - - // Check for all files inside blueprint folder - // We need to include all files - std::vector allFiles; - allFiles.push_back(blueprintName + ".smd2"); - - // Open target directory - ffw::listDirectory dir; - if(!dir.open(blueprintFolder)){ - ffw::logger().error() << "Can not look into the blueprint folder! Maybe the program does not have permissions..."; - TERMINATE(false); - } - - // Open output OBJ file - ffw::file objOutput; - if(!objOutput.open(fileOutputFolder + "\\" + fileName + ".obj", false, true, false)){ - ffw::logger().error() << "Error failed to open OBJ for writing!"; - TERMINATE(false); - } - - // Include all files that match blueprint name - for(const auto& file : dir.getFiles()){ - if(file == allFiles[0])continue; - if(file.find(blueprintNameShort) == 0){ - ffw::logger().debug() << "Adding blueprint file: " << file; - allFiles.push_back(file); - } - } - - // If no output folder is defined then the default path is C:/ - if(fileOutputFolder.size() == 0)fileOutputFolder = "C:"; - - // Check file extension - if(blueprintExtension != "smd2"){ - ffw::logger().error() << "Wrong blueprint file! Expected a file with *.smd2 extension"; - TERMINATE(false); - } - - // Begin material export - if(materialExport){ - if(textureSplit && !beginMaterialExport()){ - TERMINATE(false); - } else if(!textureSplit && !createMaterialAtlas()){ - TERMINATE(false); - } - resetMaterials(); - ffw::logger().print() << "Exporting materials is enabled!"; - } - - // Print some debug information - ffw::logger().print() << "Starting with " << threadsCount << " threads!"; - ffw::logger().print() << "Target blueprint: " << blueprintFolder; - - // Create target directories - ffw::createDirectory(executablePath + "\\temp"); - ffw::createDirectory(fileOutputFolder); - - // Load block config - if(!loadBlockTypes(starMadeDataFolder + "\\config\\BlockTypes.properties")){ - ffw::logger().error() << "Failed to load block types from \"data\\BlockTypes.properties\" Check if file exists!"; - TERMINATE(false); - } else { - ffw::logger().print() << "Block types loaded!"; - } - - if(!loadBlockConfig(starMadeDataFolder + "\\config\\BlockConfig.xml")){ - ffw::logger().error() << "Failed to load block config from \"data\\BlockConfig.xml\" Check if file exists!"; - TERMINATE(false); - } else { - ffw::logger().print() << "Block config loaded!"; - } - - // Run texture export - if(textureExport && textureSplit){ - ffw::logger().print() << "Exporting textures..."; - ffw::createDirectory(fileOutputFolder + "\\textures"); - if(!exportTextures(starMadeDataFolder + "\\textures\\block\\Default\\256")){ - TERMINATE(false); - } - } else if(textureExport){ - ffw::logger().print() << "Exporting atlases..."; - ffw::createDirectory(fileOutputFolder + "\\atlases"); - if(!exportAtlases(starMadeDataFolder + "\\textures\\block\\Default\\256")){ - TERMINATE(false); - } - } - - ffw::logger().print() << "Exporting blueprint..."; - - // Load all files - int fileIndex = 0; - for(const auto& file : allFiles){ - ffw::file fileInput; - - ffw::logger().print() << "Reading file: " << file; - - // Get file position from file name - size_t pos = file.find('.'); - if(pos == std::string::npos){ - ffw::logger().error() << "Error while retrieving file position from file name! Expected dot with coordinates!"; - TERMINATE(false); - } - - // Get position as tokens - std::vector tokens = ffw::getTokens(file.substr(pos+1, file.size()-pos-6), '.'); - if(tokens.size() != 3){ - ffw::logger().error() << "Error while retrieving file position from file name! Wrong coordinates!"; - TERMINATE(false); - } - - // Convert position to integers - ffw::vec3i filePos; - try { - filePos.x = ffw::stringToVal(tokens[0]); - filePos.y = ffw::stringToVal(tokens[0]); - filePos.z = ffw::stringToVal(tokens[0]); - filePos *= 256; - } catch (std::exception& e){ - ffw::logger().error() << "Error while retrieving file position from file name! Wrong coordinates!"; - } - - // Print file position - ffw::logger().debug() << "File position: " << filePos; - - // Open a file - if(!fileInput.open(blueprintFolder + "\\" + file, true, false, false)){ - ffw::logger().error() << "Failed to open file: " << file; - TERMINATE(false); - } - - // Check if file is big enough to contain header - size_t fileSize = fileInput.getSize(); - if(fileSize < size_t(4+32768+16384)){ - ffw::logger().error() << "File is invalid! File is too small. Expected at least 49156 bytes."; - TERMINATE(false); - } - - // Load header - int chunkIndex[CHUNK_SIZE]; - int totalChunks = 0; - if(!loadChunkHeader(&fileInput, &chunkIndex[0], &totalChunks)){ - //ffw::logger().error() << "Failed to load chunk header!"; - TERMINATE(false); - } - - // Remember the file offset - size_t fileOffset = fileInput.getPos(); - - ffw::logger().debug() << "Total chunks: " << totalChunks; - fileChunksTotal += totalChunks; - - // Sort indexes - // We need to load chunks ordered - std::sort(std::begin(chunkIndex), std::end(chunkIndex)); - - // Load all chunks - uint32_t chunkData[16][16][16]; - ffw::vec3i chunkPos; - for(int i = 0; i < CHUNK_SIZE; i++){ - if(chunkIndex[i] < 0)continue; - ffw::logger().debug() << "Loading chunk index: " << chunkIndex[i]; - - // Load chunk - fileInput.gotoPos(fileOffset + chunkIndex[i]*5120); - if(!loadChunk(&fileInput, fileOffset, chunkIndex[i], chunkData, &chunkPos)){ - continue; - } - - // Calculate bounding box - if(chunkPos.x < boundingBoxMin.x)boundingBoxMin.x = chunkPos.x; - if(chunkPos.x+16 > boundingBoxMax.x)boundingBoxMax.x = chunkPos.x+16; - - if(chunkPos.y < boundingBoxMin.y)boundingBoxMin.y = chunkPos.y; - if(chunkPos.y+16 > boundingBoxMax.y)boundingBoxMax.y = chunkPos.y+16; - - if(chunkPos.z < boundingBoxMin.z)boundingBoxMin.z = chunkPos.z; - if(chunkPos.z+16 > boundingBoxMax.z)boundingBoxMax.z = chunkPos.z+16; - - // Save decompressed raw chunk data to temp folder - if(!saveTempChunk(executablePath, chunkIndex[i], fileIndex, &chunkData[0][0][0])){ - ffw::logger().warning() << "Error while saving chunk to temp!"; - continue; - } - - // All chunk to list - chunkInfo.push_back(chunkInfoStruct{chunkPos, filePos, chunkIndex[i], fileIndex}); - } - - fileIndex++; - } - - ffw::logger().print() << "Bounding box -X: " << boundingBoxMin.x << " +X: " << boundingBoxMax.x; - ffw::logger().print() << "Bounding box -Y: " << boundingBoxMin.y << " +Y: " << boundingBoxMax.y; - ffw::logger().print() << "Bounding box -Z: " << boundingBoxMin.z << " +Z: " << boundingBoxMax.z; - - // Create threads - threads = new threadInfoStruct[threadsCount]; - for(int i = 0; i < threadsCount; i++){ - threads[i].thread.bindFunction(&processChunk); - } - - // Start exporting... - ffw::logger().print() << "Starting threads..."; - - // export chunks one by one - processedChunks = 0; - for(auto& chunk : chunkInfo){ - // Find an empty thread - while(true){ - bool found = false; - // Loop through all threads - for(int i = 0; i < threadsCount; i++){ - // We can lock a thread only of it has finished - if(threads[i].mut.tryLock()){ - // We found an empty thread, bind information and run it - processedChunks++; - progress(processedChunks, fileChunksTotal); - ffw::logger().print() << "Processing: " << processedChunks << " out of: " << fileChunksTotal; - // Unlock mutex - threads[i].mut.unlock(); - // Always join even if thread has stopped - threads[i].thread.join(); - // Bind chunk - threads[i].chunkPtr = &chunk; - // Start - threads[i].thread.start(&threads[i]); - // Wait 100ms and go to next chunk - ffw::usleep(100000); - found = true; - break; - } - } - // An empty thread was not found, wait and then try again - if(found)break; - ffw::usleep(100000); - } - } - - ffw::logger().print() << "Waiting for threads..."; - // Join all threads - for(int i = 0; i < threadsCount; i++){ - threads[i].thread.join(); - } - - // Reset indice offset - resetIndiceOffset(); - - // Generate vertices for all chunks - processedChunks = 0; - chunkBufferStruct chunkRawBuffer; - for(auto& chunk : chunkInfo){ - processedChunks++; - ffw::logger().print() << "Generating vertices: " << processedChunks << " out of: " << fileChunksTotal; - // Load a temp block to memory - loadRawBlocks(executablePath, &chunkRawBuffer, chunk.index, chunk.indexFile); - // Export block block to temp as indices and vertices - extractBlocks(executablePath, &chunkRawBuffer, chunk.index, chunk.indexFile); - } - - // End material export, we do not need it anymore - if(textureSplit && materialExport)endMaterialExport(); - - ffw::logger().print() << "Merging vertices into single OBJ..."; - - // Merge files to one OBJ file - objOutput.writeLine("# StarMade Blueprint Exporter v1.0"); - if(materialExport)objOutput.writeLine("mtllib " + fileName + ".mtl"); - objOutput.writeLine("o " + fileName); - - // Export chunks one by one - for(const auto& chunk : chunkInfo){ - ffw::file vertices; - - // Open chunk temp file which contains vertices - if(!vertices.open(executablePath + "\\temp\\" + ffw::valToString(chunk.indexFile) + "_" + ffw::valToString(chunk.index) + ".vertices.data", false, false, false)){ - ffw::logger().error() << "Error failed to open faces temp data! Index: " << chunk.index << " file: " << chunk.indexFile; - TERMINATE(false); - } - - // Read whole file and put contents in output OBJ - std::string temp; - while(!vertices.eof()){ - vertices.readLine(&temp); - if(temp.size() == 0)continue; - objOutput.writeLine(temp); - } - } - - // Export UVs - if(uvsExport && textureSplit){ - for(int i = 0; i < 4; i++){ - objOutput.writeLine("vt " + ffw::valToString(globalTextureUvs[i].x, 6) + " " + ffw::valToString(globalTextureUvs[i].y, 6)); - } - } else if(uvsExport){ - for(const auto& tile : getExtractedTiles()){ - int atlasId = tile / 256; - int posY = tile / 16; - int posX = tile - posY*16; - posY -= atlasId*16; - ffw::vec2f tilePos(posX / 16.0f, posY / 16.0f); - tilePos.y = 1.0f - tilePos.y - 0.0625f; - - for(int i = 0; i < 4; i++){ - ffw::vec2f uvs = globalTextureUvs[i]; - uvs.y = 1.0f - uvs.y; - ffw::vec2f texPos = uvs * ffw::vec2f(0.052734375f, 0.052734375f) + tilePos + 0.0048828125f; - objOutput.writeLine("vt " + ffw::valToString(texPos.x, 10) + " " + ffw::valToString(texPos.y, 10)); - } - } - } - - // Shading off - objOutput.writeLine("s off"); - - // Do the same for indices - for(const auto& chunk : chunkInfo){ - ffw::file faces; - - // Open chunk temp file which contains indices - if(!faces.open(executablePath + "\\temp\\" + ffw::valToString(chunk.indexFile) + "_" + ffw::valToString(chunk.index) + ".faces.data", false, false, false)){ - ffw::logger().error() << "Error failed to open faces temp data! Index: " << chunk.index << " file: " << chunk.indexFile; - TERMINATE(false); - } - - // Read whole file and put contents in output OBJ - std::string temp; - while(!faces.eof()){ - faces.readLine(&temp); - if(temp.size() == 0)continue; - objOutput.writeLine(temp); - } - } - - // Delete threads - delete[] threads; - - // Remove temp folder - system(std::string("rmdir /Q /S " + executablePath + "\\temp").c_str()); - - // Print some debug information - ffw::logger().print() << "OBJ file saved to: " << fileOutputFolder << "\\" << fileName << ".obj"; - ffw::logger().print() << "Export finished with no critial errors!"; - - // Terminate with success - TERMINATE(true); -}*/ diff --git a/source/exporter/exportBlueprint.h b/source/exporter/exportBlueprint.h index f7f871e..a819516 100644 --- a/source/exporter/exportBlueprint.h +++ b/source/exporter/exportBlueprint.h @@ -10,11 +10,7 @@ #include "config.h" namespace sm2obj{ - bool exportBlueprint(const std::string& InputConfigFolder, const std::string& InputFolder, - const std::string& OutputFolder, const std::string& OutputName, - bool ExportUV, bool UseAtlas, bool ExportMaterials, - bool ExportDiffuse, bool ExportAlpha, bool ExportNormals, bool ExportEmissive, - bool SpecularHighlight, int NumOfThreads, bool ExportAttachments); + bool exportBlueprint(const exportBlueprintArgs& Args); }; #endif diff --git a/source/exporter/loadMeta.cpp b/source/exporter/loadMeta.cpp index 872f3b4..b367f55 100644 --- a/source/exporter/loadMeta.cpp +++ b/source/exporter/loadMeta.cpp @@ -33,19 +33,19 @@ static size_t findName(ffw::file* Input, const std::string& Name){ } ///============================================================================= -bool sm2obj::loadMeta(entityInfoStruct* Output, const std::string& Path, const std::string& Name){ +bool sm2obj::loadMeta(const exportBlueprintArgs& Args, entityInfoStruct* Output, const std::string& Path, const std::string& Name){ ffw::file input; if(!input.open(Path, true, false, false)){ - LOG_ERROR("Failed to open meta file from: " + Path); + Args.callbackLogError("Failed to open meta file from: " + Path); return false; } - LOG_DEBUG("Reading: " + Path); + Args.callbackLogDebug("Reading: " + Path); size_t pos = findName(&input, Name); if(pos == 0){ - LOG_DEBUG("Could not load attachments for blueprint: " + Name + " Blueprint might be outdated or there are no attachments!"); + Args.callbackLogDebug("Could not load attachments for blueprint: " + Name + " Blueprint might be outdated or there are no attachments!"); return true; } @@ -55,7 +55,7 @@ bool sm2obj::loadMeta(entityInfoStruct* Output, const std::string& Path, const s uint32_t totalEntries; input.read(&totalEntries, sizeof(uint32_t)); - totalEntries = __builtin_bswap32(totalEntries); + totalEntries = ffw::byteSwap32(totalEntries); for(uint32_t i = 0; i < totalEntries; i++){ std::string name0; @@ -66,14 +66,14 @@ bool sm2obj::loadMeta(entityInfoStruct* Output, const std::string& Path, const s uint16_t strLength; input.read(&strLength, sizeof(uint16_t)); - strLength = __builtin_bswap16(strLength); + strLength = ffw::byteSwap16(strLength); name0.resize(strLength); input.read(&name0[0], strLength); input.read(&bytes0[0], sizeof(bytes0)); input.read(&strLength, sizeof(uint16_t)); - strLength = __builtin_bswap16(strLength); + strLength = ffw::byteSwap16(strLength); name1.resize(strLength); input.read(&name1[0], strLength); @@ -84,14 +84,14 @@ bool sm2obj::loadMeta(entityInfoStruct* Output, const std::string& Path, const s input.read(&pos.x, sizeof(pos.x)); input.read(&pos.y, sizeof(pos.y)); input.read(&pos.z, sizeof(pos.z)); - pos.x = __builtin_bswap32(pos.x); - pos.y = __builtin_bswap32(pos.y); - pos.z = __builtin_bswap32(pos.z); + pos.x = ffw::byteSwap32(pos.x); + pos.y = ffw::byteSwap32(pos.y); + pos.z = ffw::byteSwap32(pos.z); input.read(&orientation, sizeof(orientation)); input.read(&strLength, sizeof(uint16_t)); - strLength = __builtin_bswap16(strLength); + strLength = ffw::byteSwap16(strLength); name2.resize(strLength); input.read(&name2[0], strLength); @@ -100,9 +100,9 @@ bool sm2obj::loadMeta(entityInfoStruct* Output, const std::string& Path, const s input.read(&dockModule.x, sizeof(dockModule.x)); input.read(&dockModule.y, sizeof(dockModule.y)); input.read(&dockModule.z, sizeof(dockModule.z)); - dockModule.x = __builtin_bswap32(dockModule.x); - dockModule.y = __builtin_bswap32(dockModule.y); - dockModule.z = __builtin_bswap32(dockModule.z); + dockModule.x = ffw::byteSwap32(dockModule.x); + dockModule.y = ffw::byteSwap32(dockModule.y); + dockModule.z = ffw::byteSwap32(dockModule.z); input.read(&additionalInformation[0], sizeof(additionalInformation)); @@ -110,7 +110,7 @@ bool sm2obj::loadMeta(entityInfoStruct* Output, const std::string& Path, const s if(slash != std::string::npos){ name0 = name0.substr(slash+1, name0.size()-slash-1); } else { - LOG_ERROR("Failed to read next attachment path from meta: " + Path); + Args.callbackLogError("Failed to read next attachment path from meta: " + Path); continue; } diff --git a/source/exporter/loadMeta.h b/source/exporter/loadMeta.h index dc0bb2c..67a38e3 100644 --- a/source/exporter/loadMeta.h +++ b/source/exporter/loadMeta.h @@ -11,6 +11,6 @@ #include "config.h" namespace sm2obj{ - bool loadMeta(entityInfoStruct* Output, const std::string& Path, const std::string& Name); + bool loadMeta(const exportBlueprintArgs& Args, entityInfoStruct* Output, const std::string& Path, const std::string& Name); }; #endif diff --git a/source/exporter/materialExport.cpp b/source/exporter/materialExport.cpp index 1370ca8..f45571a 100644 --- a/source/exporter/materialExport.cpp +++ b/source/exporter/materialExport.cpp @@ -10,14 +10,14 @@ //static ffw::file material; ///============================================================================= -bool sm2obj::createMaterialAtlas(ffw::file* Output, bool UseDiffuse, bool UseNormal, bool UseAlpha, bool UseEmissive, bool Specular){ +bool sm2obj::createMaterialAtlas(const exportBlueprintArgs& Args, ffw::file* Output){ Output->writeLine("# SM2OBJ\n"); for(int i = 0; i < 3; i++){ Output->writeLine("newmtl Mat_Atlas_" + ffw::valToString(i)); Output->writeLine("Ka 0.000 0.000 0.000"); // Ambient color Output->writeLine("Kd 1.000 1.000 1.000"); // Diffuse color - if(Specular){ + if(Args.specularHighlight){ Output->writeLine("Ks 0.800 0.800 0.800"); // Specular level Output->writeLine("Ns 20.000"); // Glossiness } else { @@ -29,10 +29,10 @@ bool sm2obj::createMaterialAtlas(ffw::file* Output, bool UseDiffuse, bool UseNor // Transparency (dissolved) Output->writeLine("d 1.000000"); // Textures - if(UseDiffuse) Output->writeLine("map_Kd Atlas_" + ffw::valToString(i) + "_diff." + config::imageExtension); - if(UseNormal) Output->writeLine("map_bump Atlas_" + ffw::valToString(i) + "_bump." + config::imageExtension); - if(UseAlpha) Output->writeLine("map_d Atlas_" + ffw::valToString(i) + "_alpha." + config::imageExtension); - if(UseEmissive)Output->writeLine("map_Ke Atlas_" + ffw::valToString(i) + "_emissive." + config::imageExtension); + if(Args.exportDiffuse) Output->writeLine("map_Kd Atlas_" + ffw::valToString(i) + "_diff." + Args.textureExtension); + if(Args.exportNormals) Output->writeLine("map_bump Atlas_" + ffw::valToString(i) + "_bump." + Args.textureExtension); + if(Args.exportAlpha) Output->writeLine("map_d Atlas_" + ffw::valToString(i) + "_alpha." + Args.textureExtension); + if(Args.exportEmissive)Output->writeLine("map_Ke Atlas_" + ffw::valToString(i) + "_emissive." + Args.textureExtension); Output->writeLine("\n"); } @@ -40,11 +40,11 @@ bool sm2obj::createMaterialAtlas(ffw::file* Output, bool UseDiffuse, bool UseNor } ///============================================================================= -void sm2obj::createMaterialTile(ffw::file* Output, const blockInfoStruct* Block, int TextureIndex, bool UseDiffuse, bool UseNormal, bool UseAlpha, bool UseEmissive, bool Specular){ +void sm2obj::createMaterialTile(const exportBlueprintArgs& Args, ffw::file* Output, const blockInfoStruct* Block, int TextureIndex){ Output->writeLine("newmtl Mat_" + Block->name + "_" + ffw::valToString(TextureIndex)); Output->writeLine("Ka 0.000 0.000 0.000"); // Ambient color Output->writeLine("Kd 1.000 1.000 1.000"); // Diffuse color - if(Specular){ + if(Args.specularHighlight){ Output->writeLine("Ks 0.800 0.800 0.800"); // Specular level Output->writeLine("Ns 20.000"); // Glossiness } else { @@ -52,7 +52,7 @@ void sm2obj::createMaterialTile(ffw::file* Output, const blockInfoStruct* Block, Output->writeLine("Ns 0.000"); // Glossiness } Output->writeLine("illum 2"); // Specular on/off (1 = disabled, 2 = enabled) - if(UseEmissive && Block->emissive) + if(Args.exportEmissive && Block->emissive) // Emissive color Output->writeLine("ke " + ffw::valToString(Block->light.r, 6) + " " + ffw::valToString(Block->light.g, 6) + " " + ffw::valToString(Block->light.b, 6) + " " + ffw::valToString(Block->light.a, 6)); @@ -61,8 +61,8 @@ void sm2obj::createMaterialTile(ffw::file* Output, const blockInfoStruct* Block, // Transparency (dissolved) Output->writeLine("d 1.000000"); // Textures - if(UseDiffuse)Output->writeLine("map_Kd Tex_" + ffw::valToString(TextureIndex) + "_diff." + config::imageExtension); - if(UseNormal) Output->writeLine("map_bump Tex_" + ffw::valToString(TextureIndex) + "_bump." + config::imageExtension); - if(UseAlpha) Output->writeLine("map_d Tex_" + ffw::valToString(TextureIndex) + "_alpha." + config::imageExtension); + if(Args.exportDiffuse)Output->writeLine("map_Kd Tex_" + ffw::valToString(TextureIndex) + "_diff." + Args.textureExtension); + if(Args.exportNormals) Output->writeLine("map_bump Tex_" + ffw::valToString(TextureIndex) + "_bump." + Args.textureExtension); + if(Args.exportAlpha) Output->writeLine("map_d Tex_" + ffw::valToString(TextureIndex) + "_alpha." + Args.textureExtension); Output->writeLine("\n"); } diff --git a/source/exporter/materialExport.h b/source/exporter/materialExport.h index 6b1416e..58848b3 100644 --- a/source/exporter/materialExport.h +++ b/source/exporter/materialExport.h @@ -12,9 +12,9 @@ #include "blockConfig.h" namespace sm2obj{ - bool createMaterialAtlas(ffw::file* Output, bool UseDiffuse, bool UseNormal, bool UseAlpha, bool UseEmissive, bool Specular); + bool createMaterialAtlas(const exportBlueprintArgs& Args, ffw::file* Output); //bool beginMaterialExport(); - void createMaterialTile(ffw::file* Output, const blockInfoStruct* block, int TextureIndex, bool UseDiffuse, bool UseNormal, bool UseAlpha, bool UseEmissive, bool Specular); + void createMaterialTile(const exportBlueprintArgs& Args, ffw::file* Output, const blockInfoStruct* block, int TextureIndex); //void endMaterialExport(); } diff --git a/source/exporter/structures.h b/source/exporter/structures.h deleted file mode 100644 index 0f5306b..0000000 --- a/source/exporter/structures.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -* This file is part of SM2OBJ project. -* Copyright (C) 2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef SMD2OBJ_STRUCTURES -#define SMD2OBJ_STRUCTURES - -namespace sm2obj{ - struct chunkBufferStruct { - ffw::vec3f vertices [SM2OBJ_CHUNK_SIZE * SM2OBJ_CHUNK_MAX_VERTICES]; - ffw::vec4i indices [SM2OBJ_CHUNK_SIZE * SM2OBJ_CHUNK_MAX_INDICES]; - ffw::vec4i indicesUvs[SM2OBJ_CHUNK_SIZE * SM2OBJ_CHUNK_MAX_INDICES]; - uint16_t indicesMat [SM2OBJ_CHUNK_SIZE * SM2OBJ_CHUNK_MAX_INDICES][3]; - uint32_t indicesCount; - uint32_t verticesCount; - uint32_t indicesOffset; - std::vector extractedMaterialsList; - }; - - // Information about chunks - struct chunkInfoStruct { - // Relative position - ffw::vec3i pos; - // Relative position of the file from which chunk was loaded - ffw::vec3i posFile; - // Index of the file - int fileIndex; - }; - - // Information about entity - struct entityInfoStruct { - // Name - std::string name; - // Relative path - std::string path; - // Position of docking in parent space - ffw::vec3f pos; - // Orientation of docking - ffw::quaternion orientation; - // Position of dock module in local space - ffw::vec3f dockModule; - // Dock offset in local space - ffw::vec3f dockOffset; - // Attached ships and turrets - std::vector attachments; - // Chunk information - std::vector chunks; - // Extracted tiles - std::vector extractedTiles; - // Extracted tiles - std::vector extractedMaterials; - // Parent pointer - entityInfoStruct* parent; - }; - - // Information about thread - struct threadInfoStruct { - // Path to raw chunks - std::string tempFolder; - // Main thread class - ffw::thread thread; - // Lock mutex - ffw::mutex mut; - // Chunk information that is beeing processed by thread - chunkInfoStruct* chunkPtr; - // Buffers to save chunk data - chunkBufferStruct chunkBufferA; - chunkBufferStruct chunkBufferB; - // Pointer to the entity - entityInfoStruct* entityPtr; - }; -}; - -#endif diff --git a/source/exporter/textureExport.cpp b/source/exporter/textureExport.cpp index 6efcc63..c8e96c3 100644 --- a/source/exporter/textureExport.cpp +++ b/source/exporter/textureExport.cpp @@ -8,18 +8,16 @@ #include "blockConfig.h" #include -static std::string textures[6] = {"t000.png", "t001.png", "t002.png", "t000_NRM.png", "t001_NRM.png", "t002_NRM.png"}; - -static bool loadBlocks(const std::string& InputConfigFolder){ +static bool loadBlocks(const sm2obj::exportBlueprintArgs& Args){ sm2obj::clearBlockConfig(); // Load block types - if(!sm2obj::loadBlockTypes(InputConfigFolder + "\\BlockTypes.properties")){ - TERMINATE(false); + if(!sm2obj::loadBlockTypes(Args, Args.inputConfigFolder + "\\BlockTypes.properties")){ + return false; } // Load block config - if(!sm2obj::loadBlockConfig(InputConfigFolder + "\\BlockConfig.xml")){ - TERMINATE(false); + if(!sm2obj::loadBlockConfig(Args, Args.inputConfigFolder + "\\BlockConfig.xml")){ + return false; } return true; } @@ -59,29 +57,29 @@ static void convertNormalToBump(unsigned char* InputPixels, int InputWidth, int } ///============================================================================= -bool sm2obj::exportEmissiveAtlas(const std::string& InputConfigFolder, const std::string& OutputFolder, int TileWidth){ - LOG_DEBUG("Exporting emissive atlas"); +bool sm2obj::exportEmissiveAtlas(const exportBlueprintArgs& Args){ + Args.callbackLogDebug("Exporting emissive atlas"); - if(!loadBlocks(InputConfigFolder))return false; + if(!loadBlocks(Args))return false; int index = 0; - unsigned char* pixels = new unsigned char[TileWidth*16*TileWidth*16*3]; - int width = TileWidth*16; + unsigned char* pixels = new unsigned char[Args.width*16*Args.width*16*3]; + int width = Args.width*16; for(int i = 0; i < 3; i++){ - for(int p = 0; p < TileWidth*16*TileWidth*16*3; p++)pixels[p] = 0; + for(int p = 0; p < Args.width*16*Args.width*16*3; p++)pixels[p] = 0; for(int y = 15; y >= 0; y--){ for(int x = 0; x < 16; x++){ const blockInfoStruct* block = findBlockByTexture(index); if(block != NULL && block->emissive){ - for(int h = 0; h < TileWidth; h++){ - for(int w = 0; w < TileWidth; w++){ - pixels[width*(y*TileWidth+h)*3 + (x*TileWidth+w)*3 +0] = block->light.r * 255; - pixels[width*(y*TileWidth+h)*3 + (x*TileWidth+w)*3 +1] = block->light.g * 255; - pixels[width*(y*TileWidth+h)*3 + (x*TileWidth+w)*3 +2] = block->light.b * 255; + for(int h = 0; h < Args.width; h++){ + for(int w = 0; w < Args.width; w++){ + pixels[width*(y*Args.width+h)*3 + (x*Args.width+w)*3 +0] = char(block->light.r * 255); + pixels[width*(y*Args.width+h)*3 + (x*Args.width+w)*3 +1] = char(block->light.g * 255); + pixels[width*(y*Args.width+h)*3 + (x*Args.width+w)*3 +2] = char(block->light.b * 255); } } @@ -90,9 +88,11 @@ bool sm2obj::exportEmissiveAtlas(const std::string& InputConfigFolder, const std } } - if(!config::imageSaverFunc(OutputFolder + "\\Atlas_" + ffw::valToString(i) + "_emissive." + config::imageExtension, pixels, TileWidth*16, TileWidth*16, ffw::imageType::RGB_888)){ - LOG_ERROR("Failed to save texture: " + OutputFolder + "\\Atlas_" + ffw::valToString(i) + "_emissive." + config::imageExtension + " Program might not have permissions or target folder " + OutputFolder + " does not exists!"); - TERMINATE(false); + std::string outputFile = Args.outputFolder + "\\Atlas_" + ffw::valToString(i) + "_emissive." + Args.textureExtension; + if(!Args.imageSaver(outputFile, pixels, Args.width*16, Args.width*16, ffw::imageType::RGB_888)){ + Args.callbackLogError("Failed to save texture: " + outputFile + " Program might not have permissions or target folder " + Args.outputFolder + " does not exists!"); + Args.callbackTerminate(false); + return false; } } @@ -101,14 +101,14 @@ bool sm2obj::exportEmissiveAtlas(const std::string& InputConfigFolder, const std } ///============================================================================= -bool sm2obj::exportAtlases(const std::string& InputFolder, const std::string& OutputFolder, bool ConvertNormals){ +bool sm2obj::exportAtlases(const exportBlueprintArgs& Args){ int index = 0; - - LOG_DEBUG("Exporting textures from: " + InputFolder); + Args.callbackLogDebug("Exporting textures from: " + Args.inputFolder); int total = 6; int progress = 1; + std::string textures[6] = {"t000.png", "t001.png", "t002.png", "t000_NRM.png", "t001_NRM.png", "t002_NRM.png"}; for(int i = 0; i < 6; i++){ std::string tex = textures[i]; if(i == 3)index = 0; @@ -117,29 +117,30 @@ bool sm2obj::exportAtlases(const std::string& InputFolder, const std::string& Ou int height; int channels; ffw::imageType type; + ffw::logger().info() << "Texture: " << tex; - LOG_DEBUG("Reading file: " + InputFolder + "\\" + tex); + Args.callbackLogDebug("Reading file: " + Args.inputFolder + "\\" + tex); - if(!ffw::loadPNG(InputFolder + "\\" + tex, &pixels, &width, &height, &type)){ - LOG_ERROR("Failed to load texture: " + InputFolder + "\\" + tex); - TERMINATE(false); + if(!ffw::loadPNG(Args.inputFolder + "\\" + tex, &pixels, &width, &height, &type)){ + Args.callbackLogError("Failed to load texture: " + Args.inputFolder + "\\" + tex); + Args.callbackTerminate(false); return false; } if(width != height){ - LOG_ERROR("Failed to load texture: " + InputFolder + "\\" + tex + " Texture must have same width and height!"); - TERMINATE(false); + Args.callbackLogError("Failed to load texture: " + Args.inputFolder + "\\" + tex + " Texture must have same width and height!"); + Args.callbackTerminate(false); return false; } if(!(width == 1024 || width == 2048 || width == 4096)){ - LOG_ERROR("Failed to load texture: " + InputFolder + "\\" + tex + " Wrong texture size! Must be either 1024, 2048, or 4096!"); - TERMINATE(false); + Args.callbackLogError("Failed to load texture: " + Args.inputFolder + "\\" + tex + " Wrong texture size! Must be either 1024, 2048, or 4096!"); + Args.callbackTerminate(false); return false; } if(type == ffw::imageType::RGB_888)channels = 3; else if(type == ffw::imageType::RGB_ALPHA_8888)channels = 4; else { - LOG_ERROR("Failed to load texture: " + InputFolder + "\\" + tex + " Wrong texture format! Must be either 8-bit RGB or 8-bit RGBA!"); - TERMINATE(false); + Args.callbackLogError("Failed to load texture: " + Args.inputFolder + "\\" + tex + " Wrong texture format! Must be either 8-bit RGB or 8-bit RGBA!"); + Args.callbackTerminate(false); return false; } unsigned char* outputAlphaPixels = new unsigned char[width*height*1]; @@ -150,15 +151,16 @@ bool sm2obj::exportAtlases(const std::string& InputFolder, const std::string& Ou isNormal = true; } - LOG_INFO("Processing texture: " + tex); + Args.callbackLogInfo("Processing texture: " + tex); - PROGRESS(progress, total); + Args.callbackProgress(progress, total); // Diffuse if(!isNormal){ - if(!config::imageSaverFunc(OutputFolder + "\\Atlas_" + ffw::valToString(index) + "_diff." + config::imageExtension, pixels, width, height, type)){ - LOG_ERROR("Failed to save texture: " + OutputFolder + "\\Atlas_" + ffw::valToString(index) + "_diff." + config::imageExtension + " Program might not have permissions or target folder " + OutputFolder + " does not exists!"); - TERMINATE(false); + std::string outputFile = Args.outputFolder + "\\Atlas_" + ffw::valToString(index) + "_diff." + Args.textureExtension; + if(!Args.imageSaver(outputFile, pixels, width, height, type)){ + Args.callbackLogError("Failed to save texture: " + outputFile + " Program might not have permissions or target folder " + Args.outputFolder + " does not exists!"); + Args.callbackTerminate(false); return false; } } @@ -166,36 +168,41 @@ bool sm2obj::exportAtlases(const std::string& InputFolder, const std::string& Ou if(!isNormal && type == ffw::imageType::RGB_ALPHA_8888){ extractAlpha(pixels, width, height, outputAlphaPixels); - if(!config::imageSaverFunc(OutputFolder + "\\Atlas_" + ffw::valToString(index) + "_alpha." + config::imageExtension, outputAlphaPixels, width, height, ffw::imageType::GRAYSCALE_8)){ - LOG_ERROR("Failed to save texture: " + OutputFolder + "\\Atlas_" + ffw::valToString(index) + "_alpha." + config::imageExtension + " Program might not have permissions or target folder " + OutputFolder + " does not exists!"); - TERMINATE(false); + std::string outputFile = Args.outputFolder + "\\Atlas_" + ffw::valToString(index) + "_alpha." + Args.textureExtension; + if(!Args.imageSaver(outputFile, outputAlphaPixels, width, height, ffw::imageType::GRAYSCALE_8)){ + Args.callbackLogError("Failed to save texture: " + outputFile + " Program might not have permissions or target folder " + Args.outputFolder + " does not exists!"); + Args.callbackTerminate(false); return false; } // Alpha alternative } else if(!isNormal){ for(int p = 0; p < width*height*1; p++)outputAlphaPixels[p] = 255; - if(!config::imageSaverFunc(OutputFolder + "\\Atlas_" + ffw::valToString(index) + "_alpha." + config::imageExtension, outputAlphaPixels, width, height, ffw::imageType::GRAYSCALE_8)){ - LOG_ERROR("Failed to save texture: " + OutputFolder + "\\Atlas_" + ffw::valToString(index) + "_alpha." + config::imageExtension + " Program might not have permissions or target folder " + OutputFolder + " does not exists!"); - TERMINATE(false); + std::string outputFile = Args.outputFolder + "\\Atlas_" + ffw::valToString(index) + "_alpha." + Args.textureExtension; + if(!Args.imageSaver(outputFile, outputAlphaPixels, width, height, ffw::imageType::GRAYSCALE_8)){ + Args.callbackLogError("Failed to save texture: " + outputFile + " Program might not have permissions or target folder " + Args.outputFolder + " does not exists!"); + Args.callbackTerminate(false); return false; } } // Normals - if(isNormal && !ConvertNormals){ - if(!config::imageSaverFunc(OutputFolder + "\\Atlas_" + ffw::valToString(index) + "_bump." + config::imageExtension, pixels, width, height, type)){ - LOG_ERROR("Failed to save texture: " + OutputFolder + "\\Atlas_" + ffw::valToString(index) + "_bump." + config::imageExtension + " Program might not have permissions or target folder " + OutputFolder + " does not exists!"); - TERMINATE(false); + if(isNormal && !Args.normalToBump){ + + std::string outputFile = Args.outputFolder + "\\Atlas_" + ffw::valToString(index) + "_bump." + Args.textureExtension; + if(!Args.imageSaver(outputFile, pixels, width, height, type)){ + Args.callbackLogError("Failed to save texture: " + outputFile + " Program might not have permissions or target folder " + Args.outputFolder + " does not exists!"); + Args.callbackTerminate(false); return false; } } // Bump - if(isNormal && ConvertNormals){ + if(isNormal && Args.normalToBump){ convertNormalToBump(pixels, width, height, outputBumpPixels); - if(!config::imageSaverFunc(OutputFolder + "\\Atlas_" + ffw::valToString(index) + "_bump." + config::imageExtension, outputBumpPixels, width, height, ffw::imageType::GRAYSCALE_8)){ - LOG_ERROR("Failed to save texture: " + OutputFolder + "\\Atlas_" + ffw::valToString(index) + "_bump." + config::imageExtension + " Program might not have permissions or target folder " + OutputFolder + " does not exists!"); - TERMINATE(false); + std::string outputFile = Args.outputFolder + "\\Atlas_" + ffw::valToString(index) + "_bump." + Args.textureExtension; + if(!Args.imageSaver(outputFile, outputBumpPixels, width, height, ffw::imageType::GRAYSCALE_8)){ + Args.callbackLogError("Failed to save texture: " + outputFile + " Program might not have permissions or target folder " + Args.outputFolder + " does not exists!"); + Args.callbackTerminate(false); return false; } } @@ -207,19 +214,20 @@ bool sm2obj::exportAtlases(const std::string& InputFolder, const std::string& Ou delete[] outputBumpPixels; } - TERMINATE(true); + Args.callbackTerminate(true); return true; } ///============================================================================= -bool sm2obj::exportTextures(const std::string& InputFolder, const std::string& OutputFolder, bool ConvertNormals){ +bool sm2obj::exportTextures(const exportBlueprintArgs& Args){ int index = 0; - LOG_DEBUG("Exporting textures from: " + InputFolder); + Args.callbackLogDebug("Exporting textures from: " + Args.inputFolder); int total = 16*16*6; int progress = 1; + std::string textures[6] = {"t000.png", "t001.png", "t002.png", "t000_NRM.png", "t001_NRM.png", "t002_NRM.png"}; for(int i = 0; i < 6; i++){ std::string tex = textures[i]; if(i == 3)index = 0; @@ -229,34 +237,34 @@ bool sm2obj::exportTextures(const std::string& InputFolder, const std::string& O int channels; ffw::imageType type; - LOG_DEBUG("Reading file: " + InputFolder + "\\" + tex); + Args.callbackLogDebug("Reading file: " + Args.inputFolder + "\\" + tex); - if(!ffw::loadPNG(InputFolder + "\\" + tex, &pixels, &width, &height, &type)){ - LOG_ERROR("Failed to load texture: " + InputFolder + "\\" + tex); - TERMINATE(false); + if(!ffw::loadPNG(Args.inputFolder + "\\" + tex, &pixels, &width, &height, &type)){ + Args.callbackLogError("Failed to load texture: " + Args.inputFolder + "\\" + tex); + Args.callbackTerminate(false); return false; } if(width != height){ - LOG_ERROR("Failed to load texture: " + InputFolder + "\\" + tex + " Texture must have same width and height!"); - TERMINATE(false); + Args.callbackLogError("Failed to load texture: " + Args.inputFolder + "\\" + tex + " Texture must have same width and height!"); + Args.callbackTerminate(false); return false; } if(!(width == 1024 || width == 2048 || width == 4096)){ - LOG_ERROR("Failed to load texture: " + InputFolder + "\\" + tex + " Wrong texture size! Must be either 1024, 2048, or 4096!"); - TERMINATE(false); + Args.callbackLogError("Failed to load texture: " + Args.inputFolder + "\\" + tex + " Wrong texture size! Must be either 1024, 2048, or 4096!"); + Args.callbackTerminate(false); return false; } if(type == ffw::imageType::RGB_888)channels = 3; else if(type == ffw::imageType::RGB_ALPHA_8888)channels = 4; else { - LOG_ERROR("Failed to load texture: " + InputFolder + "\\" + tex + " Wrong texture format! Must be either 8-bit RGB or 8-bit RGBA!"); - TERMINATE(false); + Args.callbackLogError("Failed to load texture: " + Args.inputFolder + "\\" + tex + " Wrong texture format! Must be either 8-bit RGB or 8-bit RGBA!"); + Args.callbackTerminate(false); return false; } - int bleeding = (width / 16)*0.15625f; + int bleeding = int((width / 16)*0.15625f); int splitSize = (width / 16) - bleeding; - LOG_DEBUG("Splitting texture to: " + ffw::valToString(splitSize) + "x" + ffw::valToString(splitSize) + " chunks"); + Args.callbackLogDebug("Splitting texture to: " + ffw::valToString(splitSize) + "x" + ffw::valToString(splitSize) + " chunks"); unsigned char* outputDiffusePixels = new unsigned char[splitSize*splitSize*channels]; unsigned char* outputAlphaPixels = new unsigned char[splitSize*splitSize*1]; @@ -267,19 +275,20 @@ bool sm2obj::exportTextures(const std::string& InputFolder, const std::string& O isNormal = true; } - LOG_INFO("Processing texture: " + tex); + Args.callbackLogInfo("Processing texture: " + tex); for(int y = 0; y < height; y += (width / 16)){ for(int x = 0; x < width; x += (width / 16)){ - PROGRESS(progress, total); + Args.callbackProgress(progress, total); subsection(pixels, width, height, x + bleeding/2, y + bleeding/2, channels, outputDiffusePixels, splitSize, splitSize); // Diffuse if(!isNormal){ - if(!config::imageSaverFunc(OutputFolder + "\\Tex_" + ffw::valToString(index) + "_diff." + config::imageExtension, outputDiffusePixels, splitSize, splitSize, type)){ - LOG_ERROR("Failed to save texture: " + OutputFolder + "\\Tex_" + ffw::valToString(index) + "_diff." + config::imageExtension + " Program might not have permissions or target folder " + OutputFolder + " does not exists!"); - TERMINATE(false); + std::string outputFile = Args.outputFolder + "\\Tex_" + ffw::valToString(index) + "_diff." + Args.textureExtension; + if(!Args.imageSaver(outputFile, outputDiffusePixels, splitSize, splitSize, type)){ + Args.callbackLogError("Failed to save texture: " + outputFile + " Program might not have permissions or target folder " + Args.outputFolder + " does not exists!"); + Args.callbackTerminate(false); return false; } } @@ -287,9 +296,10 @@ bool sm2obj::exportTextures(const std::string& InputFolder, const std::string& O if(!isNormal && type == ffw::imageType::RGB_ALPHA_8888){ extractAlpha(outputDiffusePixels, splitSize, splitSize, outputAlphaPixels); - if(!config::imageSaverFunc(OutputFolder + "\\Tex_" + ffw::valToString(index) + "_alpha." + config::imageExtension, outputAlphaPixels, splitSize, splitSize, ffw::imageType::GRAYSCALE_8)){ - LOG_ERROR("Failed to save texture: " + OutputFolder + "\\Tex_" + ffw::valToString(index) + "_alpha." + config::imageExtension + " Program might not have permissions or target folder " + OutputFolder + " does not exists!"); - TERMINATE(false); + std::string outputFile = Args.outputFolder + "\\Tex_" + ffw::valToString(index) + "_alpha." + Args.textureExtension; + if(!Args.imageSaver(outputFile, outputAlphaPixels, splitSize, splitSize, ffw::imageType::GRAYSCALE_8)){ + Args.callbackLogError("Failed to save texture: " + outputFile + " Program might not have permissions or target folder " + Args.outputFolder + " does not exists!"); + Args.callbackTerminate(false); return false; } } @@ -297,27 +307,31 @@ bool sm2obj::exportTextures(const std::string& InputFolder, const std::string& O if(!isNormal && type == ffw::imageType::RGB_ALPHA_8888){ for(int p = 0; p < splitSize*splitSize*1; p++)outputAlphaPixels[p] = 255; - if(!config::imageSaverFunc(OutputFolder + "\\Tex_" + ffw::valToString(index) + "_alpha." + config::imageExtension, outputAlphaPixels, splitSize, splitSize, ffw::imageType::GRAYSCALE_8)){ - LOG_ERROR("Failed to save texture: " + OutputFolder + "\\Tex_" + ffw::valToString(index) + "_alpha." + config::imageExtension + " Program might not have permissions or target folder " + OutputFolder + " does not exists!"); - TERMINATE(false); + std::string outputFile = Args.outputFolder + "\\Tex_" + ffw::valToString(index) + "_alpha." + Args.textureExtension; + if(!Args.imageSaver(outputFile, outputAlphaPixels, splitSize, splitSize, ffw::imageType::GRAYSCALE_8)){ + Args.callbackLogError("Failed to save texture: " + outputFile + " Program might not have permissions or target folder " + Args.outputFolder + " does not exists!"); + Args.callbackTerminate(false); return false; } } // Normals - if(isNormal && !ConvertNormals){ - if(!config::imageSaverFunc(OutputFolder + "\\Tex_" + ffw::valToString(index) + "_bump." + config::imageExtension, outputDiffusePixels, splitSize, splitSize, type)){ - LOG_ERROR("Failed to save texture: " + OutputFolder + "\\Tex_" + ffw::valToString(index) + "_bump." + config::imageExtension + " Program might not have permissions or target folder " + OutputFolder + " does not exists!"); - TERMINATE(false); + if(isNormal && !Args.normalToBump){ + + std::string outputFile = Args.outputFolder + "\\Tex_" + ffw::valToString(index) + "_bump." + Args.textureExtension; + if(!Args.imageSaver(outputFile, outputDiffusePixels, splitSize, splitSize, type)){ + Args.callbackLogError("Failed to save texture: " + outputFile + " Program might not have permissions or target folder " + Args.outputFolder + " does not exists!"); + Args.callbackTerminate(false); return false; } } // Bump - if(isNormal && ConvertNormals){ + if(isNormal && Args.normalToBump){ convertNormalToBump(outputDiffusePixels, splitSize, splitSize, outputBumpPixels); - if(!config::imageSaverFunc(OutputFolder + "\\Tex_" + ffw::valToString(index) + "_bump." + config::imageExtension, outputBumpPixels, splitSize, splitSize, ffw::imageType::GRAYSCALE_8)){ - LOG_ERROR("Failed to save texture: " + OutputFolder + "\\Tex_" + ffw::valToString(index) + "_bump." + config::imageExtension + " Program might not have permissions or target folder " + OutputFolder + " does not exists!"); - TERMINATE(false); + std::string outputFile = Args.outputFolder + "\\Tex_" + ffw::valToString(index) + "_bump." + Args.textureExtension; + if(!Args.imageSaver(outputFile, outputBumpPixels, splitSize, splitSize, ffw::imageType::GRAYSCALE_8)){ + Args.callbackLogError("Failed to save texture: " + outputFile + " Program might not have permissions or target folder " + Args.outputFolder + " does not exists!"); + Args.callbackTerminate(false); return false; } } @@ -331,6 +345,6 @@ bool sm2obj::exportTextures(const std::string& InputFolder, const std::string& O delete[] outputBumpPixels; delete[] pixels; } - TERMINATE(true); + Args.callbackTerminate(true); return true; } diff --git a/source/exporter/textureExport.h b/source/exporter/textureExport.h index 37583b1..c5efb8e 100644 --- a/source/exporter/textureExport.h +++ b/source/exporter/textureExport.h @@ -11,9 +11,9 @@ #include "config.h" namespace sm2obj{ - bool exportEmissiveAtlas(const std::string& InputConfigFolder, const std::string& OutputFolder, int TileWidth); - bool exportTextures(const std::string& InputFolder, const std::string& OutputFolder, bool ConvertNormals); - bool exportAtlases(const std::string& InputFolder, const std::string& OutputFolder, bool ConvertNormals); + bool exportEmissiveAtlas(const exportBlueprintArgs& Args); + bool exportTextures(const exportBlueprintArgs& Args); + bool exportAtlases(const exportBlueprintArgs& Args); }; #endif diff --git a/source/main.cpp b/source/main.cpp index a3551a1..276dcda 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -4,11 +4,42 @@ * Licensed under the MIT License */ -#include "window.h" +#include "window.hpp" -static sm2obj::window mainWindow; +///============================================================================= +int main(){ + // Initialize logger + ffw::logger::initLogger(); -int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nCmdShow){ - ffw::logger::initLogger(ffw::getExecutablePath()); - return mainWindow.create(hThisInstance, nCmdShow); + // Window instance + sm2obj::window win; + + // Window arguments + ffw::uiWindowArgs args; + args.minimize = true; + args.maximize = false; + args.closeable = true; + args.border = true; + args.resizable = false; + args.customBcgColor = false; + //args.bcgColor.set(0.5f, 1.6f, 0.6f); + args.pos.set(-1, -1); + args.size.set(490, 615); + args.title = L"SM2OBJ"; + + // Create window + if(!win.create(args)){ + ffw::logger().error() << "Failed to create window!"; + } + + // Update window while it is not closed (closed != hidden) + while(!win.isClosed()){ + win.update(); + } + + // Destroy window after we are done + win.destroy(); + + // Return success + return 0; } diff --git a/source/widgets.cpp b/source/widgets.cpp deleted file mode 100644 index b789deb..0000000 --- a/source/widgets.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* -* This file is part of SM2OBJ project. -* Copyright (C) 2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#include "widgets.h" -#include "CommCtrl.h" - -HWND sm2obj::createButton(HWND Handle, const std::string& Label, int PosX, int PosY, int Width, int Height, int ID){ - return CreateWindowEx(0, "Button", Label.c_str(), WS_VISIBLE | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, PosX, PosY, Width, Height, Handle, (HMENU)ID, NULL, NULL); -} - -HWND sm2obj::createCheckbox(HWND Handle, const std::string& Label, int PosX, int PosY, int Width, int Height, int ID){ - return CreateWindowEx(0, "Button", Label.c_str(), BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE, PosX, PosY, Width, Height, Handle, (HMENU)ID, NULL, NULL); -} - -HWND sm2obj::createRadio(HWND Handle, const std::string& Label, int PosX, int PosY, int Width, int Height, int ID){ - return CreateWindowEx(0, "Button", Label.c_str(), WS_VISIBLE | WS_CHILD | WS_TABSTOP | BS_RADIOBUTTON, PosX, PosY, Width, Height, Handle, (HMENU)ID, NULL, NULL); -} - -HWND sm2obj::createTextInput(HWND Handle, const std::string& Label, int PosX, int PosY, int Width, int Height, int ID){ - return CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", Label.c_str(), WS_CHILD | WS_VISIBLE | ES_AUTOVSCROLL | ES_AUTOHSCROLL, PosX, PosY, Width, Height, Handle, (HMENU)ID, NULL, NULL); -} - -HWND sm2obj::createCombo(HWND Handle, const std::string& Label, int PosX, int PosY, int Width, int Height, int ID){ - return CreateWindowEx(WS_EX_STATICEDGE, "COMBOBOX", Label.c_str(), WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST, PosX, PosY, Width, Height, Handle, (HMENU)ID, NULL, NULL); -} - -HWND sm2obj::createList(HWND Handle, const std::string& Label, int PosX, int PosY, int Width, int Height, int ID){ - return CreateWindowEx(0, "LISTBOX", Label.c_str(), WS_BORDER | WS_CHILD | WS_VISIBLE, PosX, PosY, Width, Height, Handle, (HMENU)ID, NULL, NULL); -} - -HWND sm2obj::createProgressbar(HWND Handle, const std::string& Label, int PosX, int PosY, int Width, int Height, int ID){ - return CreateWindowEx(0, PROGRESS_CLASS, NULL, WS_CHILD | WS_VISIBLE, PosX, PosY, Width, Height, Handle, (HMENU)ID, NULL, NULL); -} - -HWND sm2obj::createLabel(HWND Handle, const std::string& Label, int PosX, int PosY, int Width, int Height, int ID){ - return CreateWindowEx(WS_EX_TRANSPARENT, "STATIC", Label.c_str(), WS_CHILD | WS_VISIBLE | SS_LEFT | WS_SYSMENU , PosX, PosY, Width, Height, Handle, (HMENU)ID, NULL, NULL); -} - -HWND sm2obj::createGroup(HWND Handle, const std::string& Label, int PosX, int PosY, int Width, int Height, int ID){ - return CreateWindowEx(0, "BUTTON", Label.c_str(), WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_GROUPBOX, PosX, PosY, Width, Height, Handle, (HMENU)ID, NULL, NULL); -} - -bool sm2obj::getCheckboxValue(HWND& Checkbox){ - return SendMessage(Checkbox, BM_GETCHECK, 0, 0); -} - -bool sm2obj::getRadioValue(HWND& Radio){ - return SendMessage(Radio, BM_GETCHECK, 0, 0); -} - -std::string sm2obj::getTextInputValue(HWND& TextInput){ - int len = SendMessage(TextInput, WM_GETTEXTLENGTH, 0, 0); - std::string buffer; - buffer.resize(len); - SendMessage(TextInput, WM_GETTEXT, (WPARAM)len+1, (LPARAM)&buffer[0]); - return buffer; -} - -int sm2obj::getComboValue(HWND& Combo){ - return SendMessage(Combo, CB_GETCURSEL , 0, 0); -} - -int sm2obj::getListValue(HWND& List){ - return SendMessage(List, LB_GETCURSEL, 0, 0); -} - -void sm2obj::setCheckboxValue(HWND& Checkbox, bool Value){ - if(Value)SendMessage(Checkbox, BM_SETCHECK, BST_CHECKED, 0); - else SendMessage(Checkbox, BM_SETCHECK, BST_UNCHECKED, 0); -} - -void sm2obj::setRadioValue(HWND& Radio, bool Value){ - if(Value)SendMessage(Radio, BM_SETCHECK, BST_CHECKED, 0); - else SendMessage(Radio, BM_SETCHECK, BST_UNCHECKED, 0); -} - -void sm2obj::setTextInputValue(HWND& TextInput, const std::string& Value){ - SendMessage(TextInput, WM_SETTEXT, 0, (LPARAM)Value.c_str()); -} - -void sm2obj::setComboValue(HWND& Combo, int Value){ - SendMessage(Combo, CB_SETCURSEL, Value, 0); -} - -void sm2obj::addComboValue(HWND& Combo, const std::string& Value){ - SendMessage(Combo, CB_ADDSTRING, 0, (LPARAM)Value.c_str()); -} - -void sm2obj::setListValue(HWND& List, int Value){ - SendMessage(List, LB_SETCURSEL, Value, 0); -} - -void sm2obj::addListValue(HWND& List, const std::string& Value){ - SendMessage(List, LB_ADDSTRING, 0, (LPARAM)Value.c_str()); -} - -void sm2obj::setProgressbarValue(HWND& Progressbar, int Value){ - SendMessage(Progressbar, PBM_SETPOS, Value, 0); -} - -void sm2obj::setLabelValue(HWND& Label, const std::string& Value){ - SendMessage(Label, WM_SETTEXT, 0, (LPARAM)Value.c_str()); -} - -void sm2obj::setWidgetFont(HWND& Widget, HFONT& Font){ - SendMessage(Widget, WM_SETFONT, (WPARAM)Font, TRUE); -} - -HFONT sm2obj::createFont(const std::string& Name, int Size, int Weight){ - return CreateFont(Size,0,0,0,Weight,FALSE,FALSE,FALSE,ANSI_CHARSET,OUT_DEVICE_PRECIS,CLIP_MASK,ANTIALIASED_QUALITY, DEFAULT_PITCH,Name.c_str()); -} - -void sm2obj::showModalInfo(HWND Handle, const std::string& Title, const std::string& Message){ - MessageBox(Handle, Message.c_str(), Title.c_str(), MB_OK | MB_ICONINFORMATION); -} - -void sm2obj::showModalError(HWND Handle, const std::string& Title, const std::string& Message){ - MessageBox(Handle, Message.c_str(), Title.c_str(), MB_OK | MB_ICONERROR); -} - -void sm2obj::showModalWarning(HWND Handle, const std::string& Title, const std::string& Message){ - MessageBox(Handle, Message.c_str(), Title.c_str(), MB_OK | MB_ICONWARNING); -} diff --git a/source/widgets.h b/source/widgets.h deleted file mode 100644 index 89c2bfb..0000000 --- a/source/widgets.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -* This file is part of SM2OBJ project. -* Copyright (C) 2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef SM2OBJ_WIDGETS -#define SM2OBJ_WIDGETS - -#include -#include -#include - -namespace sm2obj { - HWND createButton(HWND Handle, const std::string& Label, int PosX, int PosY, int Width, int Height, int ID); - HWND createCheckbox(HWND Handle, const std::string& Label, int PosX, int PosY, int Width, int Height, int ID); - HWND createRadio(HWND Handle, const std::string& Label, int PosX, int PosY, int Width, int Height, int ID); - HWND createTextInput(HWND Handle, const std::string& Label, int PosX, int PosY, int Width, int Height, int ID); - HWND createCombo(HWND Handle, const std::string& Label, int PosX, int PosY, int Width, int Height, int ID); - HWND createList(HWND Handle, const std::string& Label, int PosX, int PosY, int Width, int Height, int ID); - HWND createProgressbar(HWND Handle, const std::string& Label, int PosX, int PosY, int Width, int Height, int ID); - HWND createLabel(HWND Handle, const std::string& Label, int PosX, int PosY, int Width, int Height, int ID); - HWND createGroup(HWND Handle, const std::string& Label, int PosX, int PosY, int Width, int Height, int ID); - - bool getCheckboxValue(HWND& Checkbox); - bool getRadioValue(HWND& Radio); - std::string getTextInputValue(HWND& TextInput); - int getComboValue(HWND& Combo); - int getListValue(HWND& List); - - void setCheckboxValue(HWND& Checkbox, bool Value); - void setRadioValue(HWND& Radio, bool Value); - void setTextInputValue(HWND& TextInput, const std::string& Value); - void setComboValue(HWND& Combo, int Value); - void addComboValue(HWND& Combo, const std::string& Value); - void setListValue(HWND& List, int Value); - void addListValue(HWND& List, const std::string& Value); - void setProgressbarValue(HWND& Progressbar, int Value); - void setLabelValue(HWND& Label, const std::string& Value); - - void setWidgetFont(HWND& Widget, HFONT& Font); - - HFONT createFont(const std::string& Name, int Size, int Weight); - - void showModalInfo(HWND Handle, const std::string& Title, const std::string& Message); - void showModalError(HWND Handle, const std::string& Title, const std::string& Message); - void showModalWarning(HWND Handle, const std::string& Title, const std::string& Message); -}; - -#endif diff --git a/source/window.cpp b/source/window.cpp index 9fe49e4..f4ea9d5 100644 --- a/source/window.cpp +++ b/source/window.cpp @@ -1,632 +1,465 @@ -/* -* This file is part of SM2OBJ project. -* Copyright (C) 2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#include "window.h" -#include "CommCtrl.h" -#include "widgets.h" -#include -#include -#include "exporter/textureExport.h" -#include "exporter/exportBlueprint.h" -#include - -static int id = 100; - -static int getNewId(){ - id++; - return id; -} +#include "window.hpp" -sm2obj::defaults userInput; -sm2obj::window* sm2obj::window::instance; -HWND* sm2obj::window::hwndPtr; -HWND sm2obj::window::hwnd; -ffw::thread sm2obj::window::exportThread; -ffw::mutex sm2obj::window::exportThreadMutex; -bool sm2obj::window::warningLog; +static sm2obj::window* windowPtr = NULL; +///============================================================================= sm2obj::window::window(){ - instance = this; - - buttonSelectInputFolderID = getNewId(); - buttonSelectInputDataID = getNewId(); - buttonSelectOutputFolderID = getNewId(); - buttonSelectTextureFolderID = getNewId(); - textInputInputFolderID = getNewId(); - textInputInputDataID = getNewId(); - textInputOutputFolderID = getNewId(); - textInputTextureFolderID = getNewId(); - comboUvMapSettingsID = getNewId(); - checkboxExportMaterialsID = getNewId(); - checkboxExportDiffuseID = getNewId(); - checkboxExportAlphaID = getNewId(); - checkboxExportNormalID = getNewId(); - checkboxExportEmissiveID = getNewId(); - comboTextureNormalsID = getNewId(); - textInputNumOfThreadsID = getNewId(); - comboTextureFormatID = getNewId(); - comboTextureTypeID = getNewId(); - buttonExportTexturesID = getNewId(); - comboTextureSizeID = getNewId(); - progressbarID = getNewId(); - labelProgressTextID = getNewId(); - buttonExportObjectID = getNewId(); - checkboxSpecularHighlightID = getNewId(); - checkboxExportAttachmentsID = getNewId(); + windowPtr = this; } +///============================================================================= sm2obj::window::~window(){ } -int sm2obj::window::create(HINSTANCE hThisInstance, int nCmdShow){ - config::exportLogErrorFunc = &callbackExportLogError; - config::exportLogDebugFunc = &callbackExportLogDebug; - config::exportLogInfoFunc = &callbackExportLogInfo; - config::exportLogWarningFunc = &callbackExportLogWarning; - config::exportExitFunc = &callbackExportExit; - config::exportProgressFunc = &callbackExportProgress; - - ZeroMemory(&wincl, sizeof(wincl)); - - wincl.style = 0; - wincl.lpszMenuName = NULL; - wincl.lpszClassName = "WindowClass"; - wincl.lpfnWndProc = this->WndProc; - wincl.hInstance = hThisInstance; - wincl.hIconSm = LoadIcon(NULL, IDC_ICON); - wincl.hIcon = LoadIcon(NULL, IDC_ICON); - wincl.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); - wincl.cbWndExtra = 0; - wincl.cbSize = sizeof(WNDCLASSEX); - wincl.cbClsExtra = 0; - - if(!RegisterClassEx(&wincl)){ - MessageBox(NULL, "Could not register window!", "Error", MB_OK | MB_ICONERROR); - return -1; - } - - hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, "WindowClass", "Window", WS_MINIMIZEBOX | WS_SYSMENU | WS_CAPTION , CW_USEDEFAULT, CW_USEDEFAULT, 500, 660, NULL, NULL, hThisInstance, NULL); - - if (hwnd == NULL){ - MessageBox(NULL, "Could not create window!", "Error", MB_OK | MB_ICONERROR); - return -1; - } - - ShowWindow(hwnd, nCmdShow); - UpdateWindow(hwnd); - - while (GetMessage(&msg, 0, 0, 0)){ - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - return msg.wParam; - +///============================================================================= +void sm2obj::window::setup(){ + font = ffw::createUiFont(L"Segoe UI", 19, 550); + if(font.isValid())this->setDefaultFont(&font); + + int posY = 5; + int posYOff = 5; + + // Blueprint folder + this->addLabel(5, 5, 480, 20, L"Select blueprint folder:"); + textInputFolder = + this->addTextInput(5, 25, 430, 25, L""); + buttonSelectInputFolder = + this->addButton(440, 25, 45, 25, L"..."); + + + // StarMade data folder + this->addLabel(5, 55, 480, 20, L"Select StarMade data folder:"); + textInputData = + this->addTextInput(5, 75, 430, 25, L""); + buttonSelectInputData = + this->addButton(440, 75, 45, 25, L"..."); + + // Output folder + this->addLabel(5, 105, 480, 20, L"Select output folder for OBJ and MTL files:"); + textOutputFolder = + this->addTextInput(5, 125, 430, 25, L""); + buttonSelectOutputFolder = + this->addButton(440, 125, 45, 25, L"..."); + + // UV maps options + this->addGroup(5, 155, 480, 55, L"UV maps options:"); + comboUvMapSettings = + this->addCombo(10, 175, 470, 25); + comboUvMapSettings->addItem(L"Do not export UV maps"); + comboUvMapSettings->addItem(L"Export UV maps and split tiles (separate material per tile)"); + comboUvMapSettings->addItem(L"Export UV maps and use atlas (single material per atlas)"); + + // Material options + this->addGroup(5, 215, 235, 115, L"Material options:"); + checkboxExportMaterials = + this->addCheckbox(10, 235, 110, 20, L"Export materials"); + checkboxExportDiffuse = + this->addCheckbox(10, 265, 110, 20, L"Diffuse"); + checkboxExportAlpha = + this->addCheckbox(10, 285, 110, 20, L"Alpha"); + checkboxExportNormal = + this->addCheckbox(120, 265, 110, 20, L"Normal/bump"); + checkboxExportEmissive = + this->addCheckbox(120, 285, 110, 20, L"Emissive"); + + // System options + this->addGroup(250, 215, 235, 55, L"System options:"); + this->addLabel(255, 235, 190, 20, L"Number of threads (max 16):"); + textNumOfThreads = + this->addTextInput(440, 235, 40, 20, L"1"); + + // Attachments + this->addGroup(250, 275, 235, 55, L"Attachment options:"); + checkboxAttachments = + this->addCheckbox(255, 295, 225, 25, L"Export attached turrets/ships"); + + // Export button + buttonExportObject = + this->addButton(170, 335, 140, 35, L"Export object"); + + // Texture export options + this->addGroup(5, 375, 480, 135, L"Texture export options:"); + this->addLabel(10, 395, 470, 20, L"Select output folder for textures:"); + textTextureOutput = + this->addTextInput(10, 415, 420, 25, L""); + buttonSelectTextureOutput = + this->addButton(435, 415, 45, 25, L"..."); + + // Texture format + this->addLabel(10, 445, 100, 20, L"Texture format:"); + comboTextureFormat = + this->addCombo(110, 445, 125, 25); + comboTextureFormat->addItem(L"*.BMP"); + comboTextureFormat->addItem(L"*.PNG"); + comboTextureFormat->addItem(L"*.TGA"); + comboTextureFormat->addItem(L"*.TIFF"); + + // Texture type + this->addLabel(10, 475, 100, 20, L"Export as:"); + comboTextureType = + this->addCombo(110, 475, 125, 25); + comboTextureType->addItem(L"Separate tiles"); + comboTextureType->addItem(L"Whole atlas"); + + // Texture size + this->addLabel(245, 445, 100, 20, L"Tile size:"); + comboTextureSize = + this->addCombo(350, 445, 130, 25); + comboTextureSize->addItem(L"64px"); + comboTextureSize->addItem(L"128px"); + comboTextureSize->addItem(L"256px"); + + // Texture normals + this->addLabel(245, 475, 100, 20, L"Normals:"); + comboTextureNormals = + this->addCombo(350, 475, 130, 25); + comboTextureNormals->addItem(L"Use normals"); + comboTextureNormals->addItem(L"Convert to bump"); + + // Export textures button + buttonExportTextures = + this->addButton(170, 515, 140, 35, L"Export textures"); + + // Progressbar + progressbar = this->addProgressbar(5, 560, 480, 25); + progress = this->addLabel(5, 590, 480, 20, L""); + + std::vector missingValues; + if(userDefaults.load(ffw::getExecutablePath() + "\\defaults.json", &missingValues)){ + ffw::logger().print() << "User defaults loaded!"; + + textInputFolder ->setValue (ffw::utf8ToWstr(userDefaults.inputBlueprintFolder)); + textInputData ->setValue (ffw::utf8ToWstr(userDefaults.inputDataFolder)); + textOutputFolder ->setValue (ffw::utf8ToWstr(userDefaults.outputFileFolder)); + textTextureOutput ->setValue (ffw::utf8ToWstr(userDefaults.outputTextureFolder)); + comboUvMapSettings ->setSelected (userDefaults.uvMapsOptions); + checkboxExportMaterials ->setValue (userDefaults.exportMaterials); + checkboxExportDiffuse ->setValue (userDefaults.useDiffuseTextures); + checkboxExportAlpha ->setValue (userDefaults.useAlphaTextures); + checkboxExportNormal ->setValue (userDefaults.useNormalTextures); + checkboxExportEmissive ->setValue (userDefaults.useEmissiveTextures); + textNumOfThreads ->setValue (ffw::utf8ToWstr(userDefaults.numOfThreads)); + comboTextureFormat ->setSelected (userDefaults.textureOutputFormat); + comboTextureNormals ->setSelected (userDefaults.textureNormals); + comboTextureType ->setSelected (userDefaults.textureExportType); + comboTextureSize ->setSelected (userDefaults.textureTileSize); + checkboxAttachments ->setValue (userDefaults.exportAttachments); + } else { + ffw::logger().warning() << "User defaults failed to load! Missing values:"; + for(const auto& item : missingValues)ffw::logger().warning() << " > " << item; + } + + ffw::var data; + std::string str; + ffw::loadJSON("defaults.json", &data); + ffw::encodeJSON(&str, &data, true, true); + std::cout << str << std::endl; } -void sm2obj::window::destroy(){ - userInput.inputBlueprintFolder = getTextInputValue(textInputInputFolder); - userInput.inputDataFolder = getTextInputValue(textInputInputData); - userInput.outputFileFolder = getTextInputValue(textInputOutputFolder); - userInput.outputTextureFolder = getTextInputValue(textInputTextureFolder); - userInput.uvMapsOptions = getComboValue(comboUvMapSettings); - userInput.exportMaterials = getCheckboxValue(checkboxExportMaterials); - userInput.useDiffuseTextures = getCheckboxValue(checkboxExportDiffuse); - userInput.useAlphaTextures = getCheckboxValue(checkboxExportAlpha); - userInput.useNormalTextures = getCheckboxValue(checkboxExportNormal); - userInput.useEmissiveTextures = getCheckboxValue(checkboxExportEmissive); - userInput.specularHighlight = getCheckboxValue(checkboxSpecularHighlight); - userInput.numOfThreads = getTextInputValue(textInputNumOfThreads); - userInput.textureOutputFormat = getComboValue(comboTextureFormat); - userInput.textureNormals = getComboValue(comboTextureNormals); - userInput.textureExportType = getComboValue(comboTextureType); - userInput.textureTileSize = getComboValue(comboTextureSize); - userInput.exportAttachments = getCheckboxValue(checkboxExportAttachments); - userInput.save(ffw::getExecutablePath() + "\\user-input.json"); +///============================================================================= +void sm2obj::window::windowCloseEvent(){ + bruteforceExit(); + exportThread.join(); + + userDefaults.inputBlueprintFolder = ffw::wstrToUtf8(textInputFolder->getValue()); + userDefaults.inputDataFolder = ffw::wstrToUtf8(textInputData->getValue()); + userDefaults.outputFileFolder = ffw::wstrToUtf8(textOutputFolder->getValue()); + userDefaults.outputTextureFolder = ffw::wstrToUtf8(textTextureOutput->getValue()); + userDefaults.uvMapsOptions = comboUvMapSettings->getSelected(); + userDefaults.exportMaterials = checkboxExportMaterials->getValue(); + userDefaults.useDiffuseTextures = checkboxExportDiffuse->getValue(); + userDefaults.useAlphaTextures = checkboxExportAlpha->getValue(); + userDefaults.useNormalTextures = checkboxExportNormal->getValue(); + userDefaults.useEmissiveTextures = checkboxExportEmissive->getValue(); + userDefaults.numOfThreads = ffw::wstrToUtf8(textNumOfThreads->getValue()); + userDefaults.textureOutputFormat = comboTextureFormat->getSelected(); + userDefaults.textureNormals = comboTextureNormals->getSelected(); + userDefaults.textureExportType = comboTextureType->getSelected(); + userDefaults.textureTileSize = comboTextureSize->getSelected(); + userDefaults.exportAttachments = checkboxAttachments->getValue(); + + if(userDefaults.save(ffw::getExecutablePath() + "\\defaults.json")){ + ffw::logger().print() << "User defaults saved!"; + } else { + ffw::logger().warning() << "User defaults failed to save!"; + } + + // Remove temp folder + system(std::string("rmdir /Q /S " + ffw::getExecutablePath() + "\\temp").c_str()); + + this->destroy(); } -void sm2obj::window::callbackExportExit(bool Success){ - if(Success){ - if(warningLog){ - showModalWarning(hwnd, "Warning!", "Blueprint exported! Process ended with warning(s)! Look for warning messages in log.txt for more information."); - } else { - showModalInfo(hwnd, "Success!", "Blueprint exported! Process ended with no errors."); - } - } -} - -void sm2obj::window::callbackExportProgress(int Progress, int Total){ - int p = (Progress / float(Total)) * 100; - setProgressbarValue(instance->progressbar, p); +///============================================================================= +void sm2obj::window::callbackLogError(const std::string& Message){ + ffw::logger().error() << Message; + ffw::showModalError(windowPtr, L"Error", ffw::utf8ToWstr(Message)); } -void sm2obj::window::callbackExportLogDebug(const std::string& Message){ - ffw::logger().debug() << Message; -} - -void sm2obj::window::callbackExportLogError(const std::string& Message){ - ffw::logger().error() << Message; - showModalError(hwnd, "Error!", Message); - +///============================================================================= +void sm2obj::window::callbackLogInfo(const std::string& Message){ + ffw::logger().info() << Message; + windowPtr->progress->setValue(ffw::utf8ToWstr(Message)); } -void sm2obj::window::callbackExportLogWarning(const std::string& Message){ - ffw::logger().warning() << Message; - warningLog = true; +///============================================================================= +void sm2obj::window::callbackLogDebug(const std::string& Message){ + ffw::logger().debug() << Message; } -void sm2obj::window::callbackExportLogInfo(const std::string& Message){ - ffw::logger().print() << Message; - setLabelValue(instance->labelProgressText, Message); +///============================================================================= +void sm2obj::window::callbackLogWarning(const std::string& Message){ + ffw::logger().warning() << Message; + windowPtr->logWarning = true; } -void* sm2obj::window::exportObjectFunc(void* Data){ - warningLog = false; - callbackExportLogDebug("exportObjectFunc start"); - exportThreadMutex.lock(); - - do{ - int textureFormat = getComboValue(instance->comboTextureFormat); - if(textureFormat == 0){ - config::imageExtension = "png"; - } else if(textureFormat == 1){ - config::imageExtension = "bmp"; - } else if(textureFormat == 2){ - config::imageExtension = "tga"; - } else if(textureFormat == 3){ - config::imageExtension = "tiff"; - } else { - callbackExportLogError("Please, select texture format!"); - break; - } - - std::string blueprintFolder = getTextInputValue(instance->textInputInputFolder); - if(blueprintFolder.size() == 0){ - callbackExportLogError("Please, select blueprint folder!"); - break; - } - - std::string inputDataFolder = getTextInputValue(instance->textInputInputData); - if(inputDataFolder.size() == 0){ - callbackExportLogError("Please, select StarMade data folder!"); - break; - } - inputDataFolder += "\\config"; - - std::string outputFolder = getTextInputValue(instance->textInputOutputFolder); - if(outputFolder.size() == 0){ - callbackExportLogError("Please, select output folder!"); - break; - } - - if(blueprintFolder[blueprintFolder.size()] == '\\')blueprintFolder.pop_back(); - - std::string outputName; - size_t pos = blueprintFolder.find_last_of('\\'); - if(pos != std::string::npos && pos != blueprintFolder.size()-1){ - outputName = blueprintFolder.substr(pos+1, blueprintFolder.size()-pos-1); - callbackExportLogDebug("Output name: " + outputName); - } else { - callbackExportLogError("Could not detect blueprint folder name! Make sure the path is correct!"); - break; - } - - int numOfThreads; - try { - numOfThreads = ffw::stringToVal(getTextInputValue(instance->textInputNumOfThreads)); - } catch (std::exception& e){ - callbackExportLogError("Wrong number of threads! Please, write a number"); - break; - } - - if(numOfThreads <= 0 || numOfThreads > 16){ - callbackExportLogError("Wrong number of threads! Use values between 1 and 16"); - break; - } - - bool exportMaterials = getCheckboxValue(instance->checkboxExportMaterials); - bool exportDiffuse = getCheckboxValue(instance->checkboxExportDiffuse); - bool exportAlpha = getCheckboxValue(instance->checkboxExportAlpha); - bool exportNormal = getCheckboxValue(instance->checkboxExportNormal); - bool exportEmissive = getCheckboxValue(instance->checkboxExportEmissive); - bool specularHighloght = getCheckboxValue(instance->checkboxSpecularHighlight); - bool attachments = getCheckboxValue(instance->checkboxExportAttachments); - bool exportUvs; - bool useAtlas; - int uvOption = getComboValue(instance->comboUvMapSettings); - - if(uvOption == 0){ - useAtlas = false; - exportUvs = false; - } else if(uvOption == 1){ - exportUvs = true; - useAtlas = false; - } else if(uvOption == 2){ - exportUvs = true; - useAtlas = true; - } else { - callbackExportLogError("Please, select what to do with UV maps!"); - break; - } - - callbackExportLogDebug("Input config folder: " + inputDataFolder); - callbackExportLogDebug("Input blueprint folder: " + blueprintFolder); - callbackExportLogDebug("Output folder: " + outputFolder); - callbackExportLogDebug("Output file name: " + outputName); - callbackExportLogDebug("Export UVs: " + ffw::valToString(exportUvs)); - callbackExportLogDebug("Use atlas: " + ffw::valToString(useAtlas)); - callbackExportLogDebug("Use diffuse textures: " + ffw::valToString(exportDiffuse)); - callbackExportLogDebug("Use alpha textures: " + ffw::valToString(exportAlpha)); - callbackExportLogDebug("Use normal textures: " + ffw::valToString(exportNormal)); - callbackExportLogDebug("Use emissive textures: " + ffw::valToString(exportEmissive)); - callbackExportLogDebug("Use specular highlight: " + ffw::valToString(specularHighloght)); - callbackExportLogDebug("number of threads: " + ffw::valToString(numOfThreads)); - callbackExportLogDebug("Export attachments: " + ffw::valToString(attachments)); - - exportBlueprint(inputDataFolder, blueprintFolder, outputFolder, outputName, - exportUvs, useAtlas, exportMaterials, - exportDiffuse, exportAlpha, exportNormal, exportEmissive, - specularHighloght, numOfThreads, attachments); - - // Remove temp folder - system(std::string("rmdir /Q /S " + ffw::getExecutablePath() + "\\temp").c_str()); - - setProgressbarValue(instance->progressbar, 0); - setLabelValue(instance->labelProgressText, "Idle"); - }while(0); - - exportThreadMutex.unlock(); - callbackExportLogDebug("exportObjectFunc end"); - return NULL; +///============================================================================= +void sm2obj::window::callbackProgress(int Progress, int Total){ + int p = (Progress / float(Total)) * 100; + windowPtr->progressbar->setValue(p); } -void* sm2obj::window::exportTextuesFunc(void* Data){ - warningLog = false; - callbackExportLogDebug("exportTextuesFunc started"); - exportThreadMutex.lock(); - - do{ - int textureFormat = getComboValue(instance->comboTextureFormat); - if(textureFormat == 0){ - config::imageSaverFunc = &ffw::savePNG; - config::imageExtension = "png"; - } else if(textureFormat == 1){ - config::imageSaverFunc = &ffw::saveBMP; - config::imageExtension = "bmp"; - } else if(textureFormat == 2){ - config::imageSaverFunc = &ffw::saveTGA; - config::imageExtension = "tga"; - } else if(textureFormat == 3){ - config::imageSaverFunc = &ffw::saveTIFF; - config::imageExtension = "tiff"; +///============================================================================= +void sm2obj::window::callbackExit(bool Success){ + if(Success){ + if(windowPtr->logWarning){ + ffw::showModalWarning(windowPtr, L"Warning!", L"Blueprint exported! Process ended with warning(s)! Look for warning messages in log.txt for more information."); } else { - callbackExportLogError("Please, select texture format!"); - break; - } - - std::string inputFolder = getTextInputValue(instance->textInputInputData); - if(inputFolder.size() == 0){ - callbackExportLogError("Please, select StarMade data folder!"); - break; + ffw::showModalInfo(windowPtr, L"Success!", L"Blueprint exported! Process ended with no errors."); } - - std::string inputDataFolder = getTextInputValue(instance->textInputInputData); - if(inputDataFolder.size() == 0){ - callbackExportLogError("Please, select StarMade data folder!"); - break; - } - - std::string outputFolder = getTextInputValue(instance->textInputTextureFolder); - if(outputFolder.size() == 0){ - callbackExportLogError("Please, select texture output folder!"); - break; - } - - int texture = getComboValue(instance->comboTextureSize); - int textureSize; - if(texture == 0){ - inputFolder += "\\textures\\block\\Default\\64"; - textureSize = 64; - } else if(texture == 1){ - inputFolder += "\\textures\\block\\Default\\128"; - textureSize = 128; - } else if(texture == 2){ - inputFolder += "\\textures\\block\\Default\\256"; - textureSize = 256; - } else { - callbackExportLogError("Please, select texture size!"); - break; - } - - bool normals; - int convertNormals = getComboValue(instance->comboTextureNormals); - if(convertNormals == 0){ - normals = false; - } else if(convertNormals == 1){ - normals = true; - } else { - callbackExportLogError("Please, select what to do with normals!"); - break; - } - - int textureType = getComboValue(instance->comboTextureType); - if(textureType == 0){ - //callbackExportLogDebug("Selected \"Split tiles\" option"); - } else if(textureType == 1){ - //callbackExportLogDebug("Selected \"Use atlas\" option"); - } else { - callbackExportLogError("Please, select export type of textures! (Separate tiles or use whole atlas)"); - break; - } - - callbackExportLogDebug("StarMade texture folder: " + inputFolder); - callbackExportLogDebug("Texture output folder: " + outputFolder); - callbackExportLogDebug("Convert normals: " + ffw::valToString(normals)); - callbackExportLogDebug("Use atlas instead of splitting tiles: " + ffw::valToString(textureType)); - - if(textureType == 0){ - exportTextures(inputFolder, outputFolder, normals); - } else { - exportAtlases(inputFolder, outputFolder, normals); - exportEmissiveAtlas(inputDataFolder + "\\config", outputFolder, textureSize); - } - - setProgressbarValue(instance->progressbar, 0); - setLabelValue(instance->labelProgressText, "Idle"); - } while(0); - - exportThreadMutex.unlock(); - callbackExportLogDebug("exportTextuesFunc ended"); - return NULL; + } + windowPtr->progressbar->setValue(0); + windowPtr->progress->setValue(L""); } -void sm2obj::window::widgetCallback(HWND hwnd, WPARAM wParam){ - if(wParam == buttonSelectInputFolderID){ - std::string currentPath = getTextInputValue(textInputInputFolder); - std::wstring folder = ffw::openFolderDialog(L"Select blueprint folder", ffw::ansiToWstr(currentPath)); - if(folder.size() != 0){ - setTextInputValue(textInputInputFolder, ffw::wstrToAnsi(folder)); - } +///============================================================================= +void* sm2obj::window::exportBlueprintFunc(void* Data){ + exportThreadMutex.lock(); + logWarning = false; + + exportBlueprintArgs args; + + // Input/output folders + args.inputConfigFolder = ffw::wstrToUtf8(textInputData->getValue()) + "\\config"; + args.inputFolder = ffw::wstrToUtf8(textInputFolder->getValue()); + args.outputFolder = ffw::wstrToUtf8(textOutputFolder->getValue()); + + // Output name + size_t pos = args.inputFolder.find_last_of('\\'); + if(pos != std::string::npos && pos != args.inputFolder.size()-1){ + args.outputName = args.inputFolder.substr(pos+1, args.inputFolder.size()-pos-1); + callbackLogDebug("Output name: " + args.outputName); + } else { + callbackLogError("Could not detect blueprint folder name! Make sure the path is correct!"); + exportThreadMutex.unlock(); + return NULL; } - if(wParam == buttonSelectInputDataID){ - std::string currentPath = getTextInputValue(textInputInputData); - std::wstring folder = ffw::openFolderDialog(L"Select StarMade data folder", ffw::ansiToWstr(currentPath)); - if(folder.size() != 0){ - setTextInputValue(textInputInputData, ffw::wstrToAnsi(folder)); - } + // These arguments are not needed + args.textureExtension = ""; + args.imageSaver = NULL; + args.normalToBump = NULL; + args.width = 0; + + // UV options + int uvOption = comboUvMapSettings->getSelected(); + if(uvOption == 0){ + args.useAtlas = false; + args.exportUV = false; + } else if(uvOption == 1){ + args.exportUV = true; + args.useAtlas = false; + } else if(uvOption == 2){ + args.exportUV = true; + args.useAtlas = true; + } else { + callbackLogError("Please, select what to do with UV maps!"); + exportThreadMutex.unlock(); + return NULL; } - if(wParam == buttonSelectOutputFolderID){ - std::string currentPath = getTextInputValue(textInputOutputFolder); - std::wstring folder = ffw::openFolderDialog(L"Select output folder for OBJ and MTL file", ffw::ansiToWstr(currentPath)); - if(folder.size() != 0){ - setTextInputValue(textInputOutputFolder, ffw::wstrToAnsi(folder)); - } + // Material options + args.exportMaterials = checkboxExportMaterials->getValue(); + args.exportDiffuse = checkboxExportDiffuse->getValue(); + args.exportAlpha = checkboxExportAlpha->getValue(); + args.exportNormals = checkboxExportNormal->getValue(); + args.exportEmissive = checkboxExportEmissive->getValue(); + args.specularHighlight = true; + + // Thread options + args.numOfThreads = 0; + try { + args.numOfThreads = ffw::stringToVal(ffw::wstrToUtf8(textNumOfThreads->getValue())); + } catch (std::exception e){ + callbackLogError("Wrong number of threads! Please, write a number"); + exportThreadMutex.unlock(); + return NULL; } - if(wParam == buttonSelectTextureFolderID){ - std::string currentPath = getTextInputValue(textInputTextureFolder); - std::wstring folder = ffw::openFolderDialog(L"Select output folder for textures", ffw::ansiToWstr(currentPath)); - if(folder.size() != 0){ - setTextInputValue(textInputTextureFolder, ffw::wstrToAnsi(folder)); - } + if(args.numOfThreads < 1 || args.numOfThreads > 16){ + callbackLogError("Wrong number of threads! Use values between 1 and 16"); + exportThreadMutex.unlock(); + return NULL; } - if(wParam == buttonExportObjectID){ - if(exportThreadMutex.tryLock()){ - exportThreadMutex.unlock(); - exportThread.bindFunction(&sm2obj::window::exportObjectFunc); - exportThread.start(NULL); + // Texture extension + switch(comboTextureFormat->getSelected()){ + case 0: args.textureExtension = "bmp"; break; + case 1: args.textureExtension = "png"; break; + case 2: args.textureExtension = "tga"; break; + case 3: args.textureExtension = "tiff"; break; + default: callbackLogError("Please, select texture format!"); exportThreadMutex.unlock(); return NULL; + }; + + // Attachment options + args.exportAttachments = checkboxAttachments->getValue(); + + // Callbacks + args.callbackLogError = &this->callbackLogError; + args.callbackLogInfo = &this->callbackLogInfo; + args.callbackLogDebug = &this->callbackLogDebug; + args.callbackLogWarning = &this->callbackLogWarning; + args.callbackProgress = &this->callbackProgress; + args.callbackTerminate = &this->callbackExit; + + callbackLogDebug("Input config folder: " + args.inputConfigFolder); + callbackLogDebug("Input blueprint folder: " + args.inputFolder); + callbackLogDebug("Output folder: " + args.outputFolder); + callbackLogDebug("Output file name: " + args.outputName); + callbackLogDebug("Export UVs: " + ffw::valToString(args.exportUV)); + callbackLogDebug("Use atlas: " + ffw::valToString(args.useAtlas)); + callbackLogDebug("Use diffuse textures: " + ffw::valToString(args.exportDiffuse)); + callbackLogDebug("Use alpha textures: " + ffw::valToString(args.exportAlpha)); + callbackLogDebug("Use normal textures: " + ffw::valToString(args.exportNormals)); + callbackLogDebug("Use emissive textures: " + ffw::valToString(args.exportEmissive)); + callbackLogDebug("number of threads: " + ffw::valToString(args.numOfThreads)); + callbackLogDebug("Export attachments: " + ffw::valToString(args.exportAttachments)); + + exportBlueprint(args); + exportThreadMutex.unlock(); + return NULL; +} - } else { - showModalError(hwnd, "Error!", "Process has already begun"); - } +///============================================================================= +void* sm2obj::window::exportTexturesFunc(void* Data){ + exportThreadMutex.lock(); + logWarning = false; + + exportBlueprintArgs args; + + // Input/output folders + args.inputConfigFolder = ffw::wstrToUtf8(textInputData->getValue()) + "\\config"; + args.inputFolder = ffw::wstrToUtf8(textInputData->getValue()); + args.outputFolder = ffw::wstrToUtf8(textTextureOutput->getValue()); + + // Texture extension + switch(comboTextureFormat->getSelected()){ + case 0: args.textureExtension = "bmp"; args.imageSaver = &ffw::saveBMP; break; + case 1: args.textureExtension = "png"; args.imageSaver = &ffw::savePNG; break; + case 2: args.textureExtension = "tga"; args.imageSaver = &ffw::saveTGA; break; + case 3: args.textureExtension = "tiff"; args.imageSaver = &ffw::saveTIFF; break; + default: callbackLogError("Please, select texture format!"); exportThreadMutex.unlock(); return NULL; + }; + + // Texture size + switch(comboTextureSize->getSelected()){ + case 0: args.inputFolder += "\\textures\\block\\Default\\64"; args.width = 64; break; + case 1: args.inputFolder += "\\textures\\block\\Default\\128"; args.width = 128; break; + case 2: args.inputFolder += "\\textures\\block\\Default\\256"; args.width = 256; break; + default: callbackLogError("Please, select tile size!"); exportThreadMutex.unlock(); return NULL; + }; + + // Texture normals + switch(comboTextureNormals->getSelected()){ + case 0: args.normalToBump = false; break; + case 1: args.normalToBump = true; break; + default: callbackLogError("Please, select what to do with normals!"); exportThreadMutex.unlock(); return NULL; + }; + + // Texture type + if(comboTextureType->getSelected() < 0 || comboTextureType->getSelected() > 1){ + callbackLogError("Please, select export type of textures! (Separate tiles or use whole atlas)"); + exportThreadMutex.unlock(); return NULL; } - if(wParam == buttonExportTexturesID){ - if(exportThreadMutex.tryLock()){ - exportThreadMutex.unlock(); - exportThread.bindFunction(&sm2obj::window::exportTextuesFunc); - exportThread.start(NULL); - } else { - showModalError(hwnd, "Error!", "Process has already begun"); - } + // Callbacks + args.callbackLogError = &this->callbackLogError; + args.callbackLogInfo = &this->callbackLogInfo; + args.callbackLogDebug = &this->callbackLogDebug; + args.callbackLogWarning = &this->callbackLogWarning; + args.callbackProgress = &this->callbackProgress; + args.callbackTerminate = &this->callbackExit; + + callbackLogDebug("StarMade texture folder: " + args.inputFolder); + callbackLogDebug("Texture output folder: " + args.outputFolder); + callbackLogDebug("Convert normals: " + ffw::valToString(args.normalToBump)); + callbackLogDebug("Use atlas instead of splitting tiles: " + ffw::valToString(comboTextureType->getSelected())); + + if(comboTextureType->getSelected() == 0){ + exportTextures(args); + } else if(comboTextureType->getSelected() == 1){ + if(exportAtlases(args)) + exportEmissiveAtlas(args); } + + exportThreadMutex.unlock(); + return NULL; } -void sm2obj::window::createWidgets(HWND hwnd){ - HFONT hFont = createFont("Segoe UI", 19, 550); - - int posY = 5; - int posYoff = 5; - HWND label0 = createLabel(hwnd, "Select blueprint folder:", 5, posY, 480, 20, 0); - posY += 20; - textInputInputFolder = createTextInput(hwnd, "", 5, posY, 430, 25, textInputInputFolderID); - buttonSelectInputFolder = createButton(hwnd, "...", 440, posY, 45, 25, buttonSelectInputFolderID); - posY += 30; - - HWND label1 = createLabel(hwnd, "Select StarMade data folder:", 5, posY, 480, 20, 0); - posY += 20; - textInputInputData = createTextInput(hwnd, "", 5, posY, 430, 25, textInputInputDataID); - buttonSelectInputData = createButton(hwnd, "...", 440, posY, 45, 25, buttonSelectInputDataID); - posY += 30; - - HWND label2 = createLabel(hwnd, "Select output folder for OBJ and MTL files:", 5, posY, 480, 20, 0); - posY += 20; - textInputOutputFolder = createTextInput(hwnd, "", 5, posY, 430, 25, textInputOutputFolderID); - buttonSelectOutputFolder = createButton(hwnd, "...", 440, posY, 45, 25, buttonSelectOutputFolderID); - posY += 30; - - HWND group0 = createGroup(hwnd, "UV maps options:", 5, posY, 480, 55, 0); - posY += 20; - comboUvMapSettings = createCombo(hwnd, "", 10, posY, 470, 25, comboUvMapSettingsID); - addComboValue(comboUvMapSettings, "Do not export UV maps"); - addComboValue(comboUvMapSettings, "Export UV maps and split tiles (separate material per tile)"); - addComboValue(comboUvMapSettings, "Export UV maps and use atlas (single material per atlas)"); - - posY += 40; - posYoff = posY; - HWND group1 = createGroup(hwnd, "Material options:", 5, posY, 235, 125, 0); - posY += 20; - checkboxExportMaterials = createCheckbox(hwnd, "Export materials", 10, posY, 110, 20, checkboxExportMaterialsID); - posY += 30; - checkboxExportDiffuse = createCheckbox(hwnd, "Diffuse", 10, posY, 110, 20, checkboxExportDiffuseID); - checkboxExportAlpha = createCheckbox(hwnd, "Alpha", 10, posY +20, 110, 20, checkboxExportAlphaID); - checkboxExportNormal = createCheckbox(hwnd, "Normal / bump", 10 + 110, posY, 110, 20, checkboxExportNormalID); - checkboxExportEmissive = createCheckbox(hwnd, "Emissive", 10 + 110, posY +20, 110, 20, checkboxExportEmissiveID); - posY += 50; - checkboxSpecularHighlight = createCheckbox(hwnd, "Specular highlight", 10, posY, 200, 20, checkboxSpecularHighlightID); - - posY = posYoff; - HWND group2 = createGroup(hwnd, "System options:", 250, posY, 235, 55, 0); - posY += 20; - HWND label3 = createLabel(hwnd, "Number of threads (max 16):", 255, posY, 190, 20, 0); - textInputNumOfThreads = createTextInput(hwnd, "", 255+195, posY, 30, 25, textInputNumOfThreadsID); - - posY += 50; - HWND group3 = createGroup(hwnd, "Attachments options:", 250, posY, 235, 55, 0); - posY += 20; - checkboxExportAttachments = createCheckbox(hwnd, "Export attached turrets/ships", 255, posY, 225, 25, checkboxExportAttachmentsID); - - posY += 40; - buttonExportObject = createButton(hwnd, "Export object", 170, posY, 140, 35, buttonExportObjectID); - - posY += 40; - HWND group4 = createGroup(hwnd, "Texture export options:", 5, posY, 480, 170, 0); - posY += 20; - HWND label4 = createLabel(hwnd, "Select output folder for textures:", 10, posY, 470, 20, 0); - posY += 20; - textInputTextureFolder = createTextInput(hwnd, "", 10, posY, 420, 25, textInputTextureFolderID); - buttonSelectTextureFolder = createButton(hwnd, "...", 435, posY, 45, 25, buttonSelectTextureFolderID); - posY += 30; - posYoff = posY; - HWND label5 = createLabel(hwnd, "Output format:", 10, posY, 100, 20, 0); - comboTextureFormat = createCombo(hwnd, "", 110, posY, 125, 25, comboTextureFormatID); - addComboValue(comboTextureFormat, "*.PNG"); - addComboValue(comboTextureFormat, "*.BMP"); - addComboValue(comboTextureFormat, "*.TGA"); - addComboValue(comboTextureFormat, "*.TIFF"); - posY += 30; - HWND label6 = createLabel(hwnd, "Export as:", 10, posY, 100, 20, 0); - comboTextureType = createCombo(hwnd, "", 110, posY, 125, 25, comboTextureTypeID); - addComboValue(comboTextureType, "Separate tiles"); - addComboValue(comboTextureType, "Whole atlas"); - - posY = posYoff; - HWND label7 = createLabel(hwnd, "Tile size:", 245, posY, 100, 20, 0); - comboTextureSize = createCombo(hwnd, "", 350, posY, 130, 25, comboTextureSizeID); - addComboValue(comboTextureSize, "64px"); - addComboValue(comboTextureSize, "128px"); - addComboValue(comboTextureSize, "256px"); - posY += 30; - HWND label8 = createLabel(hwnd, "Normals:", 245, posY, 100, 20, 0); - comboTextureNormals = createCombo(hwnd, "", 350, posY, 130, 25, comboTextureNormalsID); - addComboValue(comboTextureNormals, "Use original"); - addComboValue(comboTextureNormals, "Convert to bump"); - posY += 30; - buttonExportTextures = createButton(hwnd, "Export textures", 170, posY, 140, 35, buttonExportTexturesID); - - posY += 55; - progressbar = createProgressbar(hwnd, "", 5, posY, 480, 25, progressbarID); - posY += 30; - HWND label9 = createLabel(hwnd, "Status:", 5, posY, 45, 20, 0); - labelProgressText = createLabel(hwnd, "Idle", 55, posY, 380, 20, labelProgressTextID); - - setWidgetFont(label0, hFont); - setWidgetFont(label1, hFont); - setWidgetFont(label2, hFont); - setWidgetFont(label3, hFont); - setWidgetFont(label4, hFont); - setWidgetFont(label5, hFont); - setWidgetFont(label6, hFont); - setWidgetFont(label7, hFont); - setWidgetFont(label8, hFont); - setWidgetFont(label9, hFont); - setWidgetFont(labelProgressText, hFont); - setWidgetFont(textInputInputFolder, hFont); - setWidgetFont(textInputInputData, hFont); - setWidgetFont(textInputOutputFolder, hFont); - setWidgetFont(textInputTextureFolder, hFont); - setWidgetFont(buttonSelectInputFolder, hFont); - setWidgetFont(buttonSelectInputData, hFont); - setWidgetFont(buttonSelectOutputFolder, hFont); - setWidgetFont(buttonSelectTextureFolder, hFont); - setWidgetFont(comboUvMapSettings, hFont); - setWidgetFont(checkboxExportMaterials, hFont); - setWidgetFont(checkboxExportDiffuse, hFont); - setWidgetFont(checkboxExportAlpha, hFont); - setWidgetFont(checkboxExportNormal, hFont); - setWidgetFont(checkboxExportEmissive, hFont); - setWidgetFont(checkboxSpecularHighlight, hFont); - setWidgetFont(checkboxExportAttachments, hFont); - setWidgetFont(comboTextureFormat, hFont); - setWidgetFont(comboTextureType, hFont); - setWidgetFont(comboTextureSize, hFont); - setWidgetFont(comboTextureNormals, hFont); - setWidgetFont(buttonExportTextures, hFont); - setWidgetFont(buttonExportObject, hFont); - setWidgetFont(textInputNumOfThreads, hFont); - setWidgetFont(group0, hFont); - setWidgetFont(group1, hFont); - setWidgetFont(group2, hFont); - setWidgetFont(group3, hFont); - setWidgetFont(group4, hFont); - - if(userInput.load(ffw::getExecutablePath() + "\\user-input.json")){ - setTextInputValue (textInputInputFolder, userInput.inputBlueprintFolder); - setTextInputValue (textInputInputData, userInput.inputDataFolder); - setTextInputValue (textInputOutputFolder, userInput.outputFileFolder); - setTextInputValue (textInputTextureFolder, userInput.outputTextureFolder); - setComboValue (comboUvMapSettings, userInput.uvMapsOptions); - setCheckboxValue (checkboxExportMaterials, userInput.exportMaterials); - setCheckboxValue (checkboxExportDiffuse, userInput.useDiffuseTextures); - setCheckboxValue (checkboxExportAlpha, userInput.useAlphaTextures); - setCheckboxValue (checkboxExportNormal, userInput.useNormalTextures); - setCheckboxValue (checkboxExportEmissive, userInput.useEmissiveTextures); - setCheckboxValue (checkboxSpecularHighlight, userInput.specularHighlight); - setTextInputValue (textInputNumOfThreads, userInput.numOfThreads); - setComboValue (comboTextureFormat, userInput.textureOutputFormat); - setComboValue (comboTextureNormals, userInput.textureNormals); - setComboValue (comboTextureType, userInput.textureExportType); - setComboValue (comboTextureSize, userInput.textureTileSize); - setCheckboxValue (checkboxExportAttachments, userInput.exportAttachments); - } +///============================================================================= +void sm2obj::window::widgetEvent(const ffw::uiWidget* Widget){ + // "Widget" is a pointer to a widget which was triggered by user interaction + // To test which widget was triggered, simply compare pointers + + if(Widget == buttonSelectInputData){ + std::wstring currentFolder = textInputData->getValue(); + textInputData->setValue(ffw::openFolderDialog(L"Select StarMade data folder:", currentFolder)); + } + + if(Widget == buttonSelectInputFolder){ + std::wstring currentFolder = textInputFolder->getValue(); + textInputFolder->setValue(ffw::openFolderDialog(L"Select blueprint folder:", currentFolder)); + } + + if(Widget == buttonSelectOutputFolder){ + std::wstring currentFolder = textOutputFolder->getValue(); + textOutputFolder->setValue(ffw::openFolderDialog(L"Select output folder:", currentFolder)); + } + + if(Widget == buttonSelectTextureOutput){ + std::wstring currentFolder = textTextureOutput->getValue(); + textTextureOutput->setValue(ffw::openFolderDialog(L"Select texture output folder:", currentFolder)); + } + + if(Widget == buttonExportObject){ + if(!exportThreadMutex.tryLock()){ + ffw::showModalError(this, L"Error", L"Process has already started!"); + return; + } else { + exportThreadMutex.unlock(); + exportThread.bindFunction(std::bind(&sm2obj::window::exportBlueprintFunc, this, std::placeholders::_1)); + exportThread.start(NULL); + } + } + + if(Widget == buttonExportTextures){ + if(!exportThreadMutex.tryLock()){ + ffw::showModalError(this, L"Error", L"Process has already started!"); + return; + } else { + exportThreadMutex.unlock(); + exportThread.bindFunction(std::bind(&sm2obj::window::exportTexturesFunc, this, std::placeholders::_1)); + exportThread.start(NULL); + } + } } -LRESULT CALLBACK sm2obj::window::WndProc(HWND hwnd, UINT Msg, WPARAM wParam , LPARAM lParam){ - switch (Msg){ +///============================================================================= +void sm2obj::window::windowPosEvent(short PosX, short PosY){ +} - case WM_CREATE:{ - instance->createWidgets(hwnd); - break; - } - case WM_CTLCOLORSTATIC:{ - if(GetDlgItem(hwnd, 3) == (HWND)lParam){ - SetBkMode( (HDC)wParam, TRANSPARENT); - SetTextColor((HDC)wParam, RGB(255,0,0)); - return (BOOL) GetStockObject(HOLLOW_BRUSH); - } - } - case WM_COMMAND:{ - instance->widgetCallback(hwnd, wParam); - break; - } - case WM_CLOSE:{ - instance->destroy(); - DestroyWindow(hwnd); - break; - } - case WM_DESTROY:{ - PostQuitMessage(0); - break; - } - default:{ - return DefWindowProc(hwnd, Msg, wParam, lParam); - } - } - return 0; +///============================================================================= +void sm2obj::window::windowSizeEvent(short Width, short Height){ } + + diff --git a/source/window.h b/source/window.h deleted file mode 100644 index b664f6f..0000000 --- a/source/window.h +++ /dev/null @@ -1,101 +0,0 @@ -/* -* This file is part of SM2OBJ project. -* Copyright (C) 2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef SM2OBJ_WINDOW -#define SM2OBJ_WINDOW - -#include -#include -#include "defaults.h" - -namespace sm2obj { - class window { - public: - window(); - ~window(); - - int create(HINSTANCE hThisInstance, int nCmdShow); - - private: - void destroy(); - void createWidgets(HWND hwnd); - void widgetCallback(HWND hwnd, WPARAM wParam); - static window* instance; - static HWND* hwndPtr; - static LRESULT CALLBACK WndProc(HWND hwnd, UINT Msg, WPARAM wParam , LPARAM lParam); - - static ffw::thread exportThread; - static ffw::mutex exportThreadMutex; - static void* exportObjectFunc(void* Data); - static void* exportTextuesFunc(void* Data); - - static void callbackExportExit(bool Success); - static void callbackExportProgress(int Progress, int Total); - static void callbackExportLogDebug(const std::string& Message); - static void callbackExportLogError(const std::string& Message); - static void callbackExportLogWarning(const std::string& Message); - static void callbackExportLogInfo(const std::string& Message); - - WNDCLASSEX wincl; - MSG msg; - static HWND hwnd; - static bool warningLog; - - WPARAM buttonSelectInputFolderID; - WPARAM buttonSelectInputDataID; - WPARAM buttonSelectOutputFolderID; - WPARAM buttonSelectTextureFolderID; - WPARAM textInputInputFolderID; - WPARAM textInputInputDataID; - WPARAM textInputOutputFolderID; - WPARAM textInputTextureFolderID; - WPARAM comboUvMapSettingsID; - WPARAM checkboxExportMaterialsID; - WPARAM checkboxExportDiffuseID; - WPARAM checkboxExportAlphaID; - WPARAM checkboxExportNormalID; - WPARAM checkboxExportEmissiveID; - WPARAM checkboxSpecularHighlightID; - WPARAM textInputNumOfThreadsID; - WPARAM comboTextureFormatID; - WPARAM comboTextureTypeID; - WPARAM comboTextureSizeID; - WPARAM comboTextureNormalsID; - WPARAM buttonExportTexturesID; - WPARAM progressbarID; - WPARAM labelProgressTextID; - WPARAM buttonExportObjectID; - WPARAM checkboxExportAttachmentsID; - - HWND buttonSelectInputFolder; - HWND buttonSelectInputData; - HWND buttonSelectOutputFolder; - HWND buttonSelectTextureFolder; - HWND textInputInputFolder; - HWND textInputInputData; - HWND textInputOutputFolder; - HWND textInputTextureFolder; - HWND comboUvMapSettings; - HWND checkboxExportMaterials; - HWND checkboxExportDiffuse; - HWND checkboxExportAlpha; - HWND checkboxExportNormal; - HWND checkboxExportEmissive; - HWND textInputNumOfThreads; - HWND comboTextureFormat; - HWND comboTextureType; - HWND comboTextureSize; - HWND comboTextureNormals; - HWND buttonExportTextures; - HWND progressbar; - HWND labelProgressText; - HWND buttonExportObject; - HWND checkboxSpecularHighlight; - HWND checkboxExportAttachments; - }; -}; - -#endif diff --git a/source/window.hpp b/source/window.hpp new file mode 100644 index 0000000..e3ee4df --- /dev/null +++ b/source/window.hpp @@ -0,0 +1,71 @@ +/* +* This file is part of SM2OBJ project. +* Copyright (C) 2015 by Matus Novak matusnov@gmail.com +* Licensed under the MIT License +*/ + +#ifndef SM2OBJ_WINDOW +#define SM2OBJ_WINDOW + +#include +#include "defaults.h" +#include "exporter/exportBlueprint.h" +#include "exporter/textureExport.h" + +namespace sm2obj { + class window: public ffw::uiWindow { + public: + window(); + ~window(); + private: + void setup() override; + void windowCloseEvent() override; + void widgetEvent(const ffw::uiWidget* Widget) override; + void windowPosEvent(short PosX, short PosY) override; + void windowSizeEvent(short Width, short Height) override; + + static void callbackLogError(const std::string& Message); + static void callbackLogInfo(const std::string& Message); + static void callbackLogDebug(const std::string& Message); + static void callbackLogWarning(const std::string& Message); + static void callbackProgress(int Progress, int Total); + static void callbackExit(bool Success); + + ffw::uiFont font; + public: + ffw::uiButton* buttonSelectInputFolder; + ffw::uiTextInput* textInputFolder; + ffw::uiButton* buttonSelectInputData; + ffw::uiTextInput* textInputData; + ffw::uiButton* buttonSelectOutputFolder; + ffw::uiTextInput* textOutputFolder; + ffw::uiCombo* comboUvMapSettings; + ffw::uiCheckbox* checkboxExportMaterials; + ffw::uiCheckbox* checkboxExportDiffuse; + ffw::uiCheckbox* checkboxExportAlpha; + ffw::uiCheckbox* checkboxExportNormal; + ffw::uiCheckbox* checkboxExportEmissive; + ffw::uiCheckbox* checkboxExportSpecular; + ffw::uiTextInput* textNumOfThreads; + ffw::uiCheckbox* checkboxAttachments; + ffw::uiButton* buttonExportObject; + ffw::uiButton* buttonSelectTextureOutput; + ffw::uiTextInput* textTextureOutput; + ffw::uiCombo* comboTextureFormat; + ffw::uiCombo* comboTextureType; + ffw::uiCombo* comboTextureSize; + ffw::uiCombo* comboTextureNormals; + ffw::uiButton* buttonExportTextures; + ffw::uiProgressbar* progressbar; + ffw::uiLabel* progress; + bool logWarning; + private: + sm2obj::defaults userDefaults; + ffw::thread exportThread; + ffw::mutex exportThreadMutex; + void* exportBlueprintFunc(void* Data); + void* exportTexturesFunc(void* Data); + }; +}; + +#endif diff --git a/third-party-libs/FragmentFramework/include/dll.h b/third-party-libs/FragmentFramework/include/dll.h deleted file mode 100644 index db988b5..0000000 --- a/third-party-libs/FragmentFramework/include/dll.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef FFW_DLL -#define FFW_DLL - -#ifdef _MSC_VER -#ifdef FFW_EXPORTS -#define FFW_API __declspec(dllexport) -#else -#define FFW_API __declspec(dllimport) -#endif -#endif - -#ifdef __MINGW32__ -#define FFW_API -#endif - -#endif diff --git a/third-party-libs/FragmentFramework/include/ffw.h b/third-party-libs/FragmentFramework/include/ffw.h deleted file mode 100644 index 5045bea..0000000 --- a/third-party-libs/FragmentFramework/include/ffw.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FRAGMENT_FRAMEWORK -#define FRAGMENT_FRAMEWORK - -#ifdef _MSC_VER -#pragma warning( disable: 4251 ) -#endif - -#include "gl/renderUtilities.h" -#include "gl/monitors.h" -#include "graphics/bufferObjectPool.h" -#include "graphics/bufferObject.h" -#include "graphics/graphicsFramebuffer.h" -#include "graphics/graphicsShader.h" -#include "graphics/graphicsTexture2D.h" -#include "graphics/graphicsTexture2DArray.h" -#include "graphics/graphicsTrueType.h" -#include "math/math.h" -#include "math/stringMath.h" -#include "network/networkUtils.h" -#include "network/udpListener.h" -#include "network/udpSender.h" -#include "network/tcpServer.h" -#include "network/tcpClient.h" -#include "serial/serialManager.h" -#include "systemUtils/directory.h" -#include "systemUtils/win32SysUtils.h" -#include "userInterface/manager.h" -#include "userInterface/window.h" -#include "userInterface/widgetBox.h" -#include "userInterface/widgetButton.h" -#include "userInterface/widgetButtonIcon.h" -#include "userInterface/widgetLine.h" -#include "userInterface/widgetLabel.h" -#include "userInterface/widgetIcon.h" -#include "userInterface/widgetImage.h" -#include "userInterface/widgetImageDynamic.h" -#include "userInterface/widgetList.h" -#include "userInterface/widgetSwitch.h" -#include "userInterface/widgetCheckbox.h" -#include "userInterface/widgetProgressbar.h" -#include "userInterface/widgetSlider.h" -#include "userInterface/widgetScroller.h" -#include "userInterface/widgetTextInput.h" -#include "utilities/fileUtilities.h" -#include "utilities/loadSaveBmp.h" -#include "utilities/loadSaveJson.h" -#include "utilities/loadSaveObj.h" -#include "utilities/loadSavePbm.h" -#include "utilities/loadSavePng.h" -#include "utilities/loadSaveTxt.h" -#include "utilities/loadSaveTga.h" -#include "utilities/loadSaveTiff.h" -#include "utilities/loadSaveWav.h" -#include "utilities/loadSaveXml.h" -#include "utilities/loadSaveOgg.h" -#include "utilities/file.h" -#include "utilities/logger.h" -#include "utilities/thread.h" -#include "utilities/usleep.h" -#include "utilities/mutex.h" -#include "utilities/serialization.h" -#include "renderContext.h" -#include "window.h" - -#endif diff --git a/third-party-libs/FragmentFramework/include/gl/renderUtilities.h b/third-party-libs/FragmentFramework/include/gl/renderUtilities.h deleted file mode 100644 index 1a11659..0000000 --- a/third-party-libs/FragmentFramework/include/gl/renderUtilities.h +++ /dev/null @@ -1,246 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_RENDERER -#define FFW_RENDERER - -#include -#include -#include - -#include "../dll.h" -#include "../math/math.h" -#include "../graphics/graphicsShader.h" -#include "../graphics/graphicsTexture2D.h" -#include "../graphics/graphicsTrueType.h" - -/*! - @ingroup Core -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup Core - @name GLExtProc - */ - typedef void (*GLExtProc)(void); - /*! - @memberof ffw - @ingroup Core - */ - class FFW_API renderUtilities { - public: - renderUtilities(); - /*! - @memberof renderUtilities - @ingroup Core - */ - bool initShaders(); - /*! - @memberof renderUtilities - @ingroup Core - */ - void destroyShaders(); - /*! - @memberof renderUtilities - @ingroup Core - */ - void setBlendFuncSeparate(GLenum SrcRGB, GLenum DstRGB, GLenum SrcAlpha, GLenum DstAlpha); - /*! - @memberof renderUtilities - @ingroup Core - */ - void setViewport(int PosX, int PosY, int Width, int Height); - /*! - @memberof renderUtilities - @ingroup Core - */ - void getViewMatrix(float *view); - /*! - @memberof renderUtilities - @ingroup Core - */ - void pushViewport(); - /*! - @memberof renderUtilities - @ingroup Core - */ - void popViewport(); - /*! - @memberof renderUtilities - @ingroup Core - */ - void getViewport(int *PosX, int *PosY, int *Width, int *Height); - /*! - @memberof renderUtilities - @ingroup Core - */ - const GLExtProc getOpenGLExtension(std::string FunctionName); - /*! - @memberof renderUtilities - @ingroup Core - */ - void activeTexture(int Index); - /*! - @memberof renderUtilities - @ingroup Core - */ - void setDrawBuffers(GLint Num, GLuint* DrawBuffers); - /*! - @memberof renderUtilities - @ingroup Core - */ - void setArcResolution(int Steps); - /*! - @memberof renderUtilities - @ingroup Core - */ - void drawBox(float PosX, float PosY, float PosZ, float SizeX, float SizeY, float SizeZ, const ffw::color& Color, const ffw::mat4& ModelViewProj); - /*! - @memberof renderUtilities - @ingroup Core - */ - void drawArc(float PosX, float PosY, float InnerRadius, float OuterRadius, float StartAngle, float EndAngle, const ffw::color& Color); - /*! - @memberof renderUtilities - @ingroup Core - */ - void drawRectangle(float PosX, float PosY, float Width, float Height, const ffw::color& Color); - /*! - @memberof renderUtilities - @ingroup Core - */ - void drawRectangleOut(float PosX, float PosY, float Width, float Height, const ffw::color& Color, float Outline); - /*! - @memberof renderUtilities - @ingroup Core - */ - void drawRectangleRounded(float PosX, float PosY, float Width, float Height, const ffw::color& Color, float Corner, bool TopLeft, bool TopRight, bool BottomLeft, bool BottomRight); - /*! - @memberof renderUtilities - @ingroup Core - */ - void drawRectangleRoundedOut(float PosX, float PosY, float Width, float Height, const ffw::color& Color, float Corner, bool TopLeft, bool TopRight, bool BottomLeft, bool BottomRight, float Outline); - /*! - @memberof renderUtilities - @ingroup Core - */ - void drawRectangleRounded(float PosX, float PosY, float Width, float Height, const ffw::color& Color, float Corner); - /*! - @memberof renderUtilities - @ingroup Core - */ - void drawRectangleRoundedOut(float PosX, float PosY, float Width, float Height, const ffw::color& Color, float Corner, float Outline); - /*! - @memberof renderUtilities - @ingroup Core - */ - void drawCircle(float PosX, float PosY, float Radius, const ffw::color& Color); - /*! - @memberof renderUtilities - @ingroup Core - */ - void drawCircleOut(float PosX, float PosY, float Radius, const ffw::color& Color, float Outline); - /*! - @memberof renderUtilities - @ingroup Core - */ - void drawTexture(float PosX, float PosY, float Width, float Height, ffw::texture2D *Texture, const ffw::color& Color); - /*! - @memberof renderUtilities - @ingroup Core - */ - void drawTextureMirrored(float PosX, float PosY, float Width, float Height, bool MirrorX, bool MirrorY, ffw::texture2D *Texture, const ffw::color& Color); - /*! - @memberof renderUtilities - @ingroup Core - */ - void drawTextureSubsection(float PosX, float PosY, float Width, float Height, float StartX, float StartY, float SizeX, float SizeY, ffw::texture2D *Texture, const ffw::color& Color); - /*! - @memberof renderUtilities - @ingroup Core - */ - void drawString(float PosX, float PosY, trueType* Font, const std::string& Message, const ffw::color& Color); - /*! - @memberof renderUtilities - @ingroup Core - */ - void drawString(float PosX, float PosY, trueType* Font, const std::wstring& Message, const ffw::color& Color); - /*! - @memberof renderUtilities - @ingroup Core - */ - void drawText(float PosX, float PosY, trueType* Font, text* Message, const ffw::color& Color); - /*! - @memberof renderUtilities - @ingroup Core - */ - void drawLine(float StartX, float StartY, float EndX, float EndY, const ffw::color& Color); - /*! - @memberof renderUtilities - @ingroup Core - */ - void drawLine(float StartX, float StartY, float StartZ, float EndX, float EndY, float EndZ, const ffw::color& Color, const ffw::mat4& ModelViewProj); - - private: - ffw::shader boxShader; - ffw::shader arcShader; - ffw::shader rectShader; - ffw::shader textureShader; - ffw::shader fontShader; - ffw::shader lineShader; - - int boxShaderViewProjLoc; - int boxShaderPosLoc; - int boxShaderSizeLoc; - int boxShaderColorLoc; - bool boxShaderUniform; - - int arcShaderViewLoc; - int arcShaderPosLoc; - int arcShaderSizeLoc; - int arcShaderColorLoc; - int arcShaderAngleLoc; - int arcShaderStepsLoc; - bool arcShaderUniform; - - int rectShaderViewLoc; - int rectShaderPosLoc; - int rectShaderSizeLoc; - int rectShaderColorLoc; - bool rectShaderUniform; - - int textureShaderViewLoc; - int textureShaderPosLoc; - int textureShaderSizeLoc; - int textureShaderTexSamplerLoc; - int textureShaderMirrorLoc; - int textureShaderRstvLoc; - int textureShaderColorLoc; - bool textureShaderUniform; - - int lineShaderViewLoc; - int lineShaderStartLoc; - int lineShaderEndLoc; - int lineShaderColorLoc; - bool lineShaderUniform; - - int arcShaderSteps; - - bool graphicsShadersLoaded; - int mirror[2]; - - int viewport[4]; - int viewportPush[4]; - - - PFNGLBLENDFUNCSEPARATEPROC glBlendFuncSeparate; - PFNGLACTIVETEXTUREPROC glActiveTexture; - PFNGLDRAWBUFFERSPROC glDrawBuffers; - }; -}; -#endif - diff --git a/third-party-libs/FragmentFramework/include/graphics/graphicsFramebuffer.h b/third-party-libs/FragmentFramework/include/graphics/graphicsFramebuffer.h deleted file mode 100644 index 29100e9..0000000 --- a/third-party-libs/FragmentFramework/include/graphics/graphicsFramebuffer.h +++ /dev/null @@ -1,280 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_GRAPHICS_FRAMEBUFFER -#define FFW_GRAPHICS_FRAMEBUFFER - -#include "../dll.h" -#include "graphicsTexture2D.h" - -#include -#include - -/*! - @ingroup Graphics -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup Graphics - - @brief Object on graphics card that can serve as offscreen rendering - - @details Framebuffer (or short FBO) contains single or multiple attachments. - These attachments are textures, either color texture or depth buffer. The maximum - number of possible attachments is defined by each graphics card. Framebuffer can - be activated or deactivated while render context is active. Everything drawn while - the FBO is active will not be rendered directly on the screen, instead the result - will be stored in attachment(s). The framebuffer texture can be used as any other - 2D texture. - - @code - // Example of framebuffer usage - // Pointer to active render context - ffw::renderContext* renderer; - // FBO instance - ffw::framebuffer fbo; - - // Initialize FBO - if(fbo.init() == false){ - // Failed to initialize - return -1; - } - // Start the process of creation - if(fbo.createFboBegin(800, 600) == false){ - // Failed to create - return -1; - } - // Add color attachment - // 8 bit RGBA - if(fbo.addColorAttachment(GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE) == false){ - // Failed to add attachment - return -1; - } - if(fbo.createFboEnd() == false){ - // Creation was unsuccessful! - return -1; - } - - // Start offscreen drawing - // Remember last viewport state - renderer->pushViewport(); - fbo.begin(); - // fbo.clean() is optional, use it to clear the attachments - // Viewport needs to changed to fit FBO - renderer->setViewport(800, 600); - // Everything here will be drawn into the FBO - // Draw red rectangle - renderer->drawRectangle(100, 100, 200, 150, ffw::color(1.0f, 0.0f, 0.0f, 1.0f)); - // After the drawing deactivate the FBO - fbo.end(); - - // Restore saved viewport state - renderer->popViewport(); - // Render the FBO directly on the screen - // We need to get first (zeroth) color attachment - renderer->drawTexture(0, 0, 800, 600, fbo.getColorAttachment(0), ffw::color(1.0f, 1.0f, 1.0f, 1.0f)); - // That is all... - @endcode - */ - class FFW_API framebuffer { - public: - framebuffer(); - ~framebuffer(); - /*! - @memberof framebuffer - @ingroup Graphics - - @brief Initializes required GL extensions - - @details This function needs to be called on - each instance of this class. - - @warning Render context must be active and be on - same thread before calling this function. - - @return True on success - */ - bool init(); - /*! - @memberof framebuffer - @ingroup Graphics - - @brief Returns true if framebuffer is loaded - - @return True if loaded - */ - bool isLoaded() const; - /*! - @memberof framebuffer - @ingroup Graphics - - @brief Starts the process of framebuffer creation - - @warning Render context must be active and be on - same thread before calling this function. - - @param [in] Width Width of framebuffer - @param [in] Height Height of framebuffer - - @return True on success - */ - bool createFboBegin(int Width, int Height); - /*! - @memberof framebuffer - @ingroup Graphics - - @brief Adds depth attachment - - @warning Render context must be active and be on - same thread before calling this function. - - @param [in] InternalFormat Internal format of the depth attachment (eg, GL_DEPTH_COMPONENT32, ...) - @param [in] Format Format of the depth attachment (prefer to use GL_DEPTH_COMPONENT) - @param [in] DataType Data typeof the depth attachment (eg, GL_BYTE, GL_FLOAT, ...); - - @return True if attachment has been added - */ - bool addDepthAttachment(GLenum InternalFormat, GLenum Format, GLenum DataType); - /*! - @memberof framebuffer - @ingroup Graphics - - @brief Adds color attachment - - @warning Render context must be active and be on - same thread before calling this function. - - @param [in] InternalFormat Internal format of the color attachment (eg, GL_RGBA8, GL_RGBA16, ...) - @param [in] Format Format of the color attachment (eg, GL_RGB, GL_RGBA, GL_RED, ...) - @param [in] DataType Data type of the color attachment (eg, GL_BYTE, GL_FLOAT, ...); - - @return True if attachment has been added - */ - bool addColorAttachment(GLenum InternalFormat, GLenum Format, GLenum DataType); - /*! - @memberof framebuffer - @ingroup Graphics - - @brief Ends the process of framebuffer creation - - @warning Render context must be active and be on - same thread before calling this function. - - @return True if ended successfully - */ - bool createFboEnd(); - /*! - @memberof framebuffer - @ingroup Graphics - - @brief Resizes the framebuffer - - @details Resizes the framebuffer to new specified size. - The data in each attachment will be lost! - - @warning Render context must be active and be on - same thread before calling this function. - - @param [in] Width New width - @param [in] Height New height - - @return True on success - */ - bool resizeFbo(int Width, int Height); - /*! - @memberof framebuffer - @ingroup Graphics - - @brief Deletes the framebuffer - - @warning Render context must be active and be on - same thread before calling this function. - - @return True on success - */ - bool deleteFbo(); - /*! - @memberof framebuffer - @ingroup Graphics - - @brief Activates the framebuffer - - @warning Render context must be active and be on - same thread before calling this function. - */ - void begin(); - /*! - @memberof framebuffer - @ingroup Graphics - - @brief Clears all attachments - - @warning Render context must be active and be on - same thread before calling this function. - */ - void clear(); - /*! - @memberof framebuffer - @ingroup Graphics - - @brief Deactivates the framebuffer - - @warning Render context must be active and be on - same thread before calling this function. - */ - void end(); - /*! - @memberof framebuffer - @ingroup Graphics - - @brief Returns the pointer to color attachment - - @details Index of color attachment is same as the order - of attachment cration. - - @param [in] Index on color attachment - - @return Pointer to color attachment - */ - ffw::texture2D* getColorAttachment(int Index); - /*! - @memberof framebuffer - @ingroup Graphics - - @memberof framebuffer - @ingroup Graphics - - @brief Returns the pointer to depth attachment - - @return Pointer to depth attachment - */ - ffw::texture2D* getDepthAttachment(); - - private: - // Is framebuffer loaded? - bool initialized; - bool loaded; - int fboWidth; - int fboHeight; - bool usingDepth; - GLuint fbo; - - ffw::texture2D depthAttachment; - std::vector* colorAttachments; - - PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT; - PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT; - PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT; - PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT; - PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT; - PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT; - PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT; - PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT; - PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT; - }; -}; -#endif diff --git a/third-party-libs/FragmentFramework/include/graphics/graphicsShader.h b/third-party-libs/FragmentFramework/include/graphics/graphicsShader.h deleted file mode 100644 index 5480076..0000000 --- a/third-party-libs/FragmentFramework/include/graphics/graphicsShader.h +++ /dev/null @@ -1,412 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_GRAPHICS_SHADER -#define FFW_GRAPHICS_SHADER - -#include "../dll.h" -#include "../math/math.h" -#include "../utilities/loadSaveTxt.h" - -#include -#include - -/*! - @ingroup Graphics -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup Graphics - */ - class FFW_API shader { - public: - shader(); - virtual ~shader(); - /*! - @memberof shader - @ingroup Graphics - - */ - bool init(); - /*! - @memberof shader - @ingroup Graphics - - */ - bool isLoaded() const; - /*! - @memberof shader - @ingroup Graphics - - */ - const std::string& getCompileLog() const; - /*! - @memberof shader - @ingroup Graphics - - */ - bool loadFromFile(std::string geomPath, std::string vertPath, std::string fragPath); - /*! - @memberof shader - @ingroup Graphics - - */ - bool loadFromData(const GLchar* geomData, const GLchar* vertData, const GLchar* fragData); - /*! - @memberof shader - @ingroup Graphics - - */ - bool deleteShader(); - /*! - @memberof shader - @ingroup Graphics - - */ - GLuint getProgram() const; - /*! - @memberof shader - @ingroup Graphics - - */ - void setAttributePointerf(GLint Location, GLint Size, GLsizei Stride, GLsizei Offset); - /*! - @memberof shader - @ingroup Graphics - - */ - void setAttributeDivisor(GLuint Index, GLuint Divisor); - /*! - @memberof shader - @ingroup Graphics - - */ - void drawArrays(GLenum Mode, GLint First, GLsizei Count); - /*! - @memberof shader - @ingroup Graphics - - */ - void drawArraysInstanced(GLenum Mode, GLint First, GLsizei Count, GLsizei InstanceCount); - /*! - @memberof shader - @ingroup Graphics - - */ - void drawElements(GLenum Mode, GLsizei Count, GLenum Type, const GLvoid * Indices); - /*! - @memberof shader - @ingroup Graphics - - */ - void drawElementsRange(GLenum Mode, GLuint Start, GLuint End, GLsizei Count, GLenum Type, const GLvoid * Indices); - /*! - @memberof shader - @ingroup Graphics - - */ - void drawElementsBaseVertex(GLenum Mode, GLsizei Count, GLenum Type, const GLvoid * Indices, GLint Offset); - /*! - @memberof shader - @ingroup Graphics - - */ - void drawElementsInstanced(GLenum Mode, GLsizei Count, GLenum Type, const GLvoid * Indices, GLsizei InstanceCount); - /*! - @memberof shader - @ingroup Graphics - - */ - bool begin(); - /*! - @memberof shader - @ingroup Graphics - - */ - bool end(); - /*! - @memberof shader - @ingroup Graphics - - */ - int getUniformLocation(const GLchar* Name); - /*! - @memberof shader - @ingroup Graphics - - */ - int getAttributeLocation(const GLchar* Name); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform1f(GLint location, GLfloat value); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform1fv(GLint location, const GLfloat* array, GLsizei length); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform1i(GLint location, GLint value); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform1iv(GLint location, const GLint* array, GLsizei length); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform2f(GLint location, GLfloat x, GLfloat y); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform2fv(GLint location, const GLfloat* array, GLsizei length); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform2i(GLint location, GLint x, GLint y); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform2iv(GLint location, const GLint* array, GLsizei length); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform3fv(GLint location, const GLfloat* array, GLsizei length); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform3i(GLint location, GLint x, GLint y, GLint z); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform3iv(GLint location, const GLint* array, GLsizei length); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform4fv(GLint location, const GLfloat* array, GLsizei length); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform4iv(GLint location, const GLint* array, GLsizei length); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform2f(GLint location, const ffw::vec2f& vec); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform2fv(GLint location, const ffw::vec2f* array, GLsizei length); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform2i(GLint location, const ffw::vec2i& vec); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform2iv(GLint location, const ffw::vec2i* array, GLsizei length); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform3f(GLint location, const ffw::vec3f& vec); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform3fv(GLint location, const ffw::vec3f* array, GLsizei length); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform3i(GLint location, const ffw::vec3i& vec); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform3iv(GLint location, const ffw::vec3i* array, GLsizei length); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform4f(GLint location, const ffw::vec4f& vec); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform4fv(GLint location, const ffw::vec4f* array, GLsizei length); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform4i(GLint location, const ffw::vec4i& vec); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform4iv(GLint location, const ffw::vec4i* array, GLsizei length); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform4f(GLint location, const ffw::color& vec); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniform4fv(GLint location, const ffw::color* array, GLsizei length); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniformMatrix2fv(GLint location, const GLfloat* mat, GLsizei length); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniformMatrix3fv(GLint location, const GLfloat* mat, GLsizei length); - /*! - @memberof shader - @ingroup Graphics - - */ - void setUniformMatrix4fv(GLint location, const GLfloat* mat, GLsizei length); - - private: - // Compile shader - bool compileShader(GLuint &thisShader, const GLchar* data, GLenum shaderType); - // Check for shader compilation errors - bool checkForShaderErrors(GLuint thisShader, std::string* ErrorStr); - // Check for program linking errors - bool checkForProgramErrors(std::string* ErrorStr); - // Is shader loaded? - bool loaded; - // Shader program - GLuint program; - // Geometry shader - GLuint geomShader; - // Vertex shader - GLuint vertShader; - // Fragment shader - GLuint fragShader; - // Is geometry shader loaded? - bool usingGeom; - // Is vertex shader loaded? - bool usingVert; - // Is fragment shader loaded? - bool usingFrag; - std::string* errorLogStr; - - bool initialized; - - PFNGLUSEPROGRAMPROC glUseProgram; - PFNGLCOMPILESHADERPROC glCompileShader; - PFNGLCREATEPROGRAMPROC glCreateProgram; - PFNGLCREATESHADERPROC glCreateShader; - PFNGLDELETEPROGRAMPROC glDeleteProgram; - PFNGLDELETESHADERPROC glDeleteShader; - PFNGLATTACHSHADERPROC glAttachShader; - PFNGLGETSHADERIVPROC glGetShaderiv; - PFNGLLINKPROGRAMPROC glLinkProgram; - PFNGLSHADERSOURCEPROC glShaderSource; - PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog; - PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog; - PFNGLGETPROGRAMIVPROC glGetProgramiv; - PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer; - PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray; - PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation; - PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation; - PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements; - PFNGLDRAWELEMENTSBASEVERTEXPROC glDrawElementsBaseVertex; - PFNGLDRAWARRAYSINSTANCEDPROC glDrawArraysInstanced; - PFNGLDRAWELEMENTSINSTANCEDPROC glDrawElementsInstanced; - PFNGLVERTEXATTRIBDIVISORPROC glVertexAttribDivisor; - PFNGLUNIFORM1FPROC glUniform1f; - PFNGLUNIFORM1FVPROC glUniform1fv; - PFNGLUNIFORM1IPROC glUniform1i; - PFNGLUNIFORM1IVPROC glUniform1iv; - PFNGLUNIFORM2FPROC glUniform2f; - PFNGLUNIFORM2FVPROC glUniform2fv; - PFNGLUNIFORM2IPROC glUniform2i; - PFNGLUNIFORM2IVPROC glUniform2iv; - PFNGLUNIFORM3FPROC glUniform3f; - PFNGLUNIFORM3FVPROC glUniform3fv; - PFNGLUNIFORM3IPROC glUniform3i; - PFNGLUNIFORM3IVPROC glUniform3iv; - PFNGLUNIFORM4FPROC glUniform4f; - PFNGLUNIFORM4FVPROC glUniform4fv; - PFNGLUNIFORM4IPROC glUniform4i; - PFNGLUNIFORM4IVPROC glUniform4iv; - PFNGLUNIFORMMATRIX2FVPROC glUniformMatrix2fv; - PFNGLUNIFORMMATRIX3FVPROC glUniformMatrix3fv; - PFNGLUNIFORMMATRIX4FVPROC glUniformMatrix4fv; - }; -}; -#endif diff --git a/third-party-libs/FragmentFramework/include/graphics/graphicsTrueType.h b/third-party-libs/FragmentFramework/include/graphics/graphicsTrueType.h deleted file mode 100644 index f4c048a..0000000 --- a/third-party-libs/FragmentFramework/include/graphics/graphicsTrueType.h +++ /dev/null @@ -1,200 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_TRUE_TYPE -#define FFW_TRUE_TYPE - -#include -#include "../dll.h" -#include "graphicsTexture2D.h" -#include "bufferObject.h" -#include "graphicsShader.h" -#include "graphicsText.h" -#include "../utilities/logger.h" - -#define UNICODE_MAX 65536 - -/*! - @ingroup Graphics -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup Graphics - */ - class FFW_API trueType { - public: - trueType(); - virtual ~trueType(); - /*! - @memberof trueType - @ingroup Graphics - - */ - bool init(); - /*! - @memberof trueType - @ingroup Graphics - - */ - bool isLoaded() const; - /*! - @memberof trueType - @ingroup Graphics - - */ - bool deleteFont(); - /*! - @memberof trueType - @ingroup Graphics - - */ - bool loadFromData(const unsigned char* Buffer, size_t Length, int Points, int Dpi); - /*! - @memberof trueType - @ingroup Graphics - - */ - bool loadFromFile(std::string Path, int Points, int Dpi); - /*! - @memberof trueType - @ingroup Graphics - - */ - void getCharVertices(unsigned short C, vec4f& v0, vec4f& v1, vec4f& v2, vec4f& v3); - /*! - @memberof trueType - @ingroup Graphics - - */ - bool createTextBuffer(text* Text, const std::string& Message); - /*! - @memberof trueType - @ingroup Graphics - - */ - bool createTextBuffer(text* Text, const std::wstring& Message); - /*! - @memberof trueType - @ingroup Graphics - - */ - void drawChar(int PosX, int PosY, shader *FontShader, float* ViewMatrix, unsigned short Unicode, const color& Color, float Scale); - /*! - @memberof trueType - @ingroup Graphics - - */ - void drawString(int PosX, int PosY, shader *FontShader, float* ViewMatrix, const std::string& Message, const color& Color, float Scale); - /*! - @memberof trueType - @ingroup Graphics - - */ - void drawString(int PosX, int PosY, shader* FontShader, float* ViewMatrix, const std::wstring& Message, const color& Color, float Scale); - /*! - @memberof trueType - @ingroup Graphics - - */ - void drawText(int PosX, int PosY, shader* FontShader, float* ViewMatrix, text* Message, const color& Color, float Scale); - /*! - @memberof trueType - @ingroup Graphics - - */ - int getCharAdvance(unsigned short C) const; - /*! - @memberof trueType - @ingroup Graphics - - */ - void setLineHeight(int Height); - /*! - @memberof trueType - @ingroup Graphics - - */ - int getLineHeight() const; - /*! - @memberof trueType - @ingroup Graphics - - */ - texture2D *getFontTexture(); - /*! - @memberof trueType - @ingroup Graphics - - */ - int getFontSize() const; - /*! - @memberof trueType - @ingroup Graphics - - */ - int getFontDPI() const; - /*! - @memberof trueType - @ingroup Graphics - - */ - vec2i getStringSize(const std::string& Str); - /*! - @memberof trueType - @ingroup Graphics - - */ - vec2i getStringSize(const std::wstring& Str); - - private: - bool initLibrary(); - bool loadFontFace(void* FontFacePtr, int Error, int Points, int Dpi); - bool renderGlyph(void* FontFacePtr, int GlyphIndex, int Unicode); - bool constructVbo(); - bool initDrawing(); - template void drawTemplate(int PosX, int PosY, shader *FontShader, float* ViewMatrix, const T& Message, const color& Color, float Scale); - template bool createTextTemplate(text* Text, const T& Message); - template vec2i getStringSizeTemplate(const T& Str); - std::wstring tempChar; - - struct charStruct{ - unsigned char* pixels; - short texWidth; - short texHeight; - short width; - short height; - short x; - short y; - short left; - short bearing; - short advance; - unsigned short unicode; - }; - - std::vector allCharacters; - ffw::texture2D fontTexture; - ffw::bufferObject fontVBO; - int fontSizePixels; - int fontSizePoints; - int fontDpi; - int fontLineHeight; - - bool loaded = false; - unsigned short unicodePtr[UNICODE_MAX]; - - int shaderViewLoc; - int shaderTexSampleLoc; - int shaderColorLoc; - int shaderPositionLoc; - int shaderTexCoordsLoc; - int shaderOffsetLoc; - int shaderScaleLoc; - bool shaderUniform; - }; -}; -#endif - diff --git a/third-party-libs/FragmentFramework/include/graphics/shaderArcData.h b/third-party-libs/FragmentFramework/include/graphics/shaderArcData.h deleted file mode 100644 index ac97689..0000000 --- a/third-party-libs/FragmentFramework/include/graphics/shaderArcData.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_SHADER_ARC_DATA -#define FFW_SHADER_ARC_DATA - -#include - -/*! - @ingroup Graphics -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup Graphics - @brief Vertex data for basic acr shader - */ - extern std::string arcShaderVertData; - /*! - @memberof ffw - @ingroup Graphics - @brief Fragment data for basic acr shader - */ - extern std::string arcShaderFragData; -}; - -#endif diff --git a/third-party-libs/FragmentFramework/include/graphics/shaderBoxData.h b/third-party-libs/FragmentFramework/include/graphics/shaderBoxData.h deleted file mode 100644 index 3bbdef9..0000000 --- a/third-party-libs/FragmentFramework/include/graphics/shaderBoxData.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_SHADER_BOX_DATA -#define FFW_SHADER_BOX_DATA - -#include - -/*! - @ingroup Graphics -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup Graphics - @brief Vertex data for basic rectangle shader - */ - extern std::string boxShaderVertData; - /*! - @memberof ffw - @ingroup Graphics - @brief Fragment data for basic rectangle shader - */ - extern std::string boxShaderFragData; -}; - -#endif - - diff --git a/third-party-libs/FragmentFramework/include/graphics/shaderFontData.h b/third-party-libs/FragmentFramework/include/graphics/shaderFontData.h deleted file mode 100644 index 39ebb62..0000000 --- a/third-party-libs/FragmentFramework/include/graphics/shaderFontData.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_SHADER_FONT_DATA -#define FFW_SHADER_FONT_DATA - -#include - -/*! - @ingroup Graphics -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup Graphics - @brief Vertex data for basic font shader - */ - extern std::string fontShaderVertData; - /*! - @memberof ffw - @ingroup Graphics - @brief Fragment data for basic font shader - */ - extern std::string fontShaderFragData; -}; - -#endif - diff --git a/third-party-libs/FragmentFramework/include/graphics/shaderLineData.h b/third-party-libs/FragmentFramework/include/graphics/shaderLineData.h deleted file mode 100644 index 40c792f..0000000 --- a/third-party-libs/FragmentFramework/include/graphics/shaderLineData.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_SHADER_LINE_DATA -#define FFW_SHADER_LINE_DATA - -#include - -/*! - @ingroup Graphics -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup Graphics - @brief Vertex data for basic line shader - */ - extern std::string lineShaderVertData; - /*! - @memberof ffw - @ingroup Graphics - @brief Fragment data for basic line shader - */ - extern std::string lineShaderFragData; -}; - -#endif - diff --git a/third-party-libs/FragmentFramework/include/graphics/shaderRectData.h b/third-party-libs/FragmentFramework/include/graphics/shaderRectData.h deleted file mode 100644 index bd9074c..0000000 --- a/third-party-libs/FragmentFramework/include/graphics/shaderRectData.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_SHADER_RECT_DATA -#define FFW_SHADER_RECT_DATA - -#include - -/*! - @ingroup Graphics -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup Graphics - @brief Vertex data for basic rectangle shader - */ - extern std::string rectShaderVertData; - /*! - @memberof ffw - @ingroup Graphics - @brief Fragment data for basic rectangle shader - */ - extern std::string rectShaderFragData; -}; - -#endif - diff --git a/third-party-libs/FragmentFramework/include/graphics/shaderTextureData.h b/third-party-libs/FragmentFramework/include/graphics/shaderTextureData.h deleted file mode 100644 index 0c7ddb6..0000000 --- a/third-party-libs/FragmentFramework/include/graphics/shaderTextureData.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_SHADER_TEXTURE_DATA -#define FFW_SHADER_TEXTURE_DATA - -#include - -/*! - @ingroup Graphics -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup Graphics - @brief Vertex data for basic texture shader - */ - extern std::string textureShaderVertData; - /*! - @memberof ffw - @ingroup Graphics - @brief Fragment data for basic texture shader - */ - extern std::string textureShaderFragData; -}; - -#endif - diff --git a/third-party-libs/FragmentFramework/include/math/math.inl b/third-party-libs/FragmentFramework/include/math/math.inl deleted file mode 100644 index 45414b1..0000000 --- a/third-party-libs/FragmentFramework/include/math/math.inl +++ /dev/null @@ -1,265 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_MATH_INL -#define FFW_MATH_INL - -template -inline T ffw::lerp(const T& A, const T& B, float Weight) { - return (1-Weight)*A + Weight*B; -} - -template -inline ffw::vec2 ffw::lerp(const ffw::vec2& A, const ffw::vec2& B, float Weight) { - vec2 result; - result.x = A.x*(1-Weight) + B.x*Weight; - result.y = A.y*(1-Weight) + B.y*Weight; - return result; -} - -template -inline ffw::vec3 ffw::lerp(const ffw::vec3& A, const ffw::vec3& B, float Weight) { - vec3 result; - result.x = A.x*(1-Weight) + B.x*Weight; - result.y = A.y*(1-Weight) + B.y*Weight; - result.z = A.z*(1-Weight) + B.z*Weight; - return result; -} - -template -inline ffw::vec4 ffw::lerp(const ffw::vec4& A, const ffw::vec4& B, float Weight) { - vec4 result; - result.x = A.x*(1-Weight) + B.x*Weight; - result.y = A.y*(1-Weight) + B.y*Weight; - result.z = A.z*(1-Weight) + B.z*Weight; - result.w = A.w*(1-Weight) + B.w*Weight; - return result; -} - -template -inline float dot(const ffw::vec2& V1, const ffw::vec2& V2){ - return (V1.x*V2.x + V1.y*V2.y); -} - -template -inline float ffw::dot(const ffw::vec3& V1, const ffw::vec3& V2){ - return (V1.x*V2.x + V1.y*V2.y + V1.z*V2.z); -} - -template -inline ffw::vec3 ffw::cross(const ffw::vec3& V1, const ffw::vec3& V2){ - ffw::vec3 product; - product.x = V1.y*V2.z - V1.z*V2.y; - product.y = V1.z*V2.x - V1.x*V2.z; - product.z = V1.x*V2.y - V1.y*V2.x; - return product; -} - -template -inline ffw::vec2 ffw::normalize(const vec2& V){ - ffw::vec2 result; - float l = sqrtf(V.x*V.x + V.y*V.y); - if( l > 0 ) { - result.x = V.x/l; - result.y = V.y/l; - } - return result; -} - -template -inline ffw::vec3 ffw::normalize(const vec3& V){ - ffw::vec3 result; - float l = sqrtf(V.x*V.x + V.y*V.y + V.z*V.z); - if( l > 0 ) { - result.x = V.x/l; - result.y = V.y/l; - result.z = V.z/l; - } - return result; -} - -template -inline ffw::vec4 ffw::normalize(const vec4& V){ - ffw::vec4 result; - float l = sqrtf(V.x*V.x + V.y*V.y + V.z*V.z + V.w*V.w); - if( l > 0 ) { - result.x = V.x/l; - result.y = V.y/l; - result.z = V.z/l; - result.w = V.w/l; - } - return result; -} - -inline ffw::quaternion ffw::normalize(const quaternion& Q){ - quaternion result; - float n = 1.0f/sqrt(Q.x*Q.x+Q.y*Q.y+Q.z*Q.z+Q.w*Q.w); - result.x = Q.x * n; - result.y = Q.y * n; - result.z = Q.z * n; - result.w = Q.w * n; - return result; -} - -template -inline float ffw::angle(const ffw::vec3& V1, const ffw::vec3& V2){ - float dot = (V1.x*V2.x + V1.y*V2.y + V1.z*V2.z); - float V1Length = sqrtf(V1.x*V1.x + V1.y*V1.y + V1.z*V1.z); - float V2Length = sqrtf(V2.x*V2.x + V2.y*V2.y + V2.z*V2.z); - return acos(dot / (V1Length*V2Length))*57.29577951; -} - -template -inline float ffw::angle(const ffw::vec2& V1, const ffw::vec2& V2){ - float dot = (V1.x*V2.x + V1.y*V2.y); - float V1Length = sqrtf(V1.x*V1.x + V1.y*V1.y); - float V2Length = sqrtf(V2.x*V2.x + V2.y*V2.y); - return acos(dot / (V1Length*V2Length))*57.29577951; -} - -template -inline float ffw::angleRad(const ffw::vec3& V1, const ffw::vec3& V2){ - float dot = (V1.x*V2.x + V1.y*V2.y + V1.z*V2.z); - float V1Length = sqrtf(V1.x*V1.x + V1.y*V1.y + V1.z*V1.z); - float V2Length = sqrtf(V2.x*V2.x + V2.y*V2.y + V2.z*V2.z); - return acos(dot / (V1Length*V2Length)); -} - -template -inline float ffw::angleRad(const ffw::vec2& V1, const ffw::vec2& V2){ - float dot = (V1.x*V2.x + V1.y*V2.y); - float V1Length = sqrtf(V1.x*V1.x + V1.y*V1.y); - float V2Length = sqrtf(V2.x*V2.x + V2.y*V2.y); - return acos(dot / (V1Length*V2Length)); -} - -inline ffw::mat4 ffw::makeProjectionMatrix(float FieldOfView, float Aspect, float Near, float Far){ - float halfFov = FieldOfView/2.0f; - float tanFov = tanf(halfFov*DEG_TO_RAD); - ffw::mat4 mat; - mat.ptr[0] = 1.0f / (Aspect * tanFov); - mat.ptr[5] = 1.0f / tanFov; - mat.ptr[10] = (Near + Far) / (Near - Far); - mat.ptr[11] = -1.0f; - mat.ptr[14] = (2.0f * Far * Near) / (Near - Far); - return mat; -} - -inline ffw::mat4 ffw::makeLookAtMatrix(ffw::vec3f Eyes, ffw::vec3f Target, ffw::vec3f UpVector){ - ffw::mat4 mat; - ffw::vec3f f = ffw::normalize(Target - Eyes); - ffw::vec3f s = ffw::normalize(ffw::cross(f, UpVector)); - ffw::vec3f u = ffw::cross(s, f); - - mat[0] = s.x; - mat[4] = s.y; - mat[8] = s.z; - mat[3] = 0.0f; - mat[1] = u.x; - mat[5] = u.y; - mat[9] = u.z; - mat[7] = 0.0f; - mat[2] = -f.x; - mat[6] = -f.y; - mat[10] = -f.z; - mat[11] = 0.0f; - mat[12] = -ffw::dot(s, Eyes); - mat[13] = -ffw::dot(u, Eyes); - mat[14] = ffw::dot(f, Eyes); - mat[15] = 1.0f; - - return mat; -} - -inline ffw::mat4 ffw::makeFpsCameraMatrix(ffw::vec3f Eyes, float Pitch, float Yaw){ - float cPitch = cos(Pitch*DEG_TO_RAD); - float sPitch = sin(Pitch*DEG_TO_RAD); - float cYaw = cos(Yaw*DEG_TO_RAD); - float sYaw = sin(Yaw*DEG_TO_RAD); - - ffw::mat4 mat; - ffw::vec3f s(cYaw, 0, -sYaw); - ffw::vec3f u(sYaw * sPitch, cPitch, cYaw * sPitch); - ffw::vec3f f(sYaw * cPitch, -sPitch, cPitch * cYaw); - - mat[0] = s.x; - mat[4] = s.y; - mat[8] = s.z; - mat[3] = 0.0f; - mat[1] = u.x; - mat[5] = u.y; - mat[9] = u.z; - mat[7] = 0.0f; - mat[2] = -f.x; - mat[6] = -f.y; - mat[10] = -f.z; - mat[11] = 0.0f; - mat[12] = -ffw::dot(s, Eyes); - mat[13] = -ffw::dot(u, Eyes); - mat[14] = ffw::dot(f, Eyes); - mat[15] = 1.0f; - - return mat; -} - -inline uint32_t ffw::getRandom() { - uint32_t t; - - t = randX ^ (randX << 11); - randX = randY; randY = randZ; randZ = randW; - return randW = randW ^ (randW >> 19) ^ (t ^ (t >> 8)); -} - -inline float ffw::getRandomf(){ - return float(getRandom())/4294967296.0f; -} - -inline uint32_t ffw::getRandom(uint32_t Min, uint32_t Max){ - return getRandom() % Max + Min; -} - -inline float ffw::getAbsf(float Val){ - if(Val > 0.0f)return Val; - else return -Val; -} - -inline float ffw::getAbsd(double Val){ - if(Val > 0.0)return Val; - else return -Val; -} - -template -inline float ffw::clamp(T Val, T Min, T Max){ - if(Val < Min)return Min; - else if(Val > Max)return Max; - return Val; -} - -inline float ffw::clampf(float Val){ - if(Val < 0.0f)return 0.0f; - else if(Val > 1.0f)return 1.0f; - return Val; -} - -inline float ffw::clampd(double Val){ - if(Val < 0.0)return 0.0f; - else if(Val > 1.0)return 1.0; - return Val; -} - -inline float ffw::remap(float Value, float InMin, float InMax, float OutMin, float OutMax){ - return (Value - InMin) / (InMax - InMin) * (OutMax - OutMin) + OutMin; -} - -inline uint32_t ffw::nextPowOfTwo(uint32_t Value){ - uint32_t P = 1; - while(P < Value){ - P *= 2; - } - return P; -} - -#endif diff --git a/third-party-libs/FragmentFramework/include/math/quaternion.inl b/third-party-libs/FragmentFramework/include/math/quaternion.inl deleted file mode 100644 index 29406d5..0000000 --- a/third-party-libs/FragmentFramework/include/math/quaternion.inl +++ /dev/null @@ -1,141 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_QUATERNION_INL -#define FFW_QUATERNION_INL - -///============================================================================= -inline ffw::quaternion::quaternion(){ - x = 0.0f; - y = 0.0f; - z = 0.0f; - w = 1.0f; -} - -///============================================================================= -inline ffw::quaternion::quaternion(float X, float Y, float Z, float W){ - x = X; - y = Y; - z = Z; - w = W; -} - -///============================================================================= -inline ffw::quaternion::quaternion(const quaternion& Quat){ - x = Quat.x; - y = Quat.y; - z = Quat.z; - w = Quat.w; -} - -///============================================================================= -inline void ffw::quaternion::set(float X, float Y, float Z, float W){ - x = X; - y = Y; - z = Z; - w = W; -} - -///============================================================================= -inline void ffw::quaternion::set(const quaternion& Quat){ - x = Quat.x; - y = Quat.y; - z = Quat.z; - w = Quat.w; -} - -///============================================================================= -inline ffw::quaternion& ffw::quaternion::rotate(float Deg, float X, float Y, float Z){ - float angle = Deg*DEG_TO_RAD; - double result = sin(angle/2.0); - x = X * result; - y = Y * result; - z = Z * result; - w = cos(angle/2.0); - normalize(); - return *this; -} - -///============================================================================= -inline ffw::quaternion& ffw::quaternion::rotateRad(float Rad, float X, float Y, float Z){ - double result = sin(Rad/2.0); - x = X * result; - y = Y * result; - z = Z * result; - w = cos(Rad/2.0); - normalize(); - return *this; -} - -///============================================================================= -inline ffw::quaternion ffw::quaternion::operator * (const quaternion& Quat) const{ - quaternion result; - - result.x = Quat.w*x + Quat.x*w + Quat.y*z - Quat.z*y; - result.y = Quat.w*y - Quat.x*z + Quat.y*w + Quat.z*x; - result.z = Quat.w*z + Quat.x*y - Quat.y*x + Quat.z*w; - result.w = Quat.w*w - Quat.x*x - Quat.y*y - Quat.z*z; - - return result; -} - -///============================================================================= -inline ffw::quaternion& ffw::quaternion::operator *= (const quaternion& Quat){ - float rx = Quat.w*x + Quat.x*w + Quat.y*z - Quat.z*y; - float ry = Quat.w*y - Quat.x*z + Quat.y*w + Quat.z*x; - float rz = Quat.w*z + Quat.x*y - Quat.y*x + Quat.z*w; - float rw = Quat.w*w - Quat.x*x - Quat.y*y - Quat.z*z; - - x = rx; - y = ry; - z = rz; - w = rw; - - return *this; -} - -///============================================================================= -inline void ffw::quaternion::normalize(){ - float n = 1.0f/sqrt(x*x+y*y+z*z+w*w); - x = x * n; - y = y * n; - z = z * n; - w = w * n; -} - -///============================================================================= -inline void ffw::quaternion::getEuler(float* Roll, float* Pitch, float* Yaw) const{ - // http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/ - float test = x*y + z*w; - float heading; - float attitude; - float bank; - - if (test > 0.499) { // singularity at north pole - heading = 2.0f * atan2(x, w); - attitude = M_PI_2; - bank = 0; - - } else if (test < -0.499) { // singularity at south pole - heading = -2.0f * atan2(x, w); - attitude = - M_PI_2; - bank = 0; - - } else { - float sqx = x * x; - float sqy = y * y; - float sqz = z * z; - heading = atan2(2.0f * y * w - 2.0f * x * z, 1.0f - 2.0f*sqy - 2.0f*sqz); - attitude = asin(2*test); - bank = atan2(2.0f*x * w - 2.0f * y * z, 1.0f - 2.0f*sqx - 2.0f*sqz); - } - - *Roll = attitude *DEG_TO_RAD; - *Pitch = heading *DEG_TO_RAD; - *Yaw = bank *DEG_TO_RAD; -} - -#endif diff --git a/third-party-libs/FragmentFramework/include/math/stringMath.h b/third-party-libs/FragmentFramework/include/math/stringMath.h deleted file mode 100644 index a276e4e..0000000 --- a/third-party-libs/FragmentFramework/include/math/stringMath.h +++ /dev/null @@ -1,244 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_STRING_MATH -#define FFW_STRING_MATH - -#include -#include -#include -#include -#include -#include -#include -#include - -/*! - @ingroup Math -*/ -namespace ffw{ - /*! - @memberof ffw - @ingroup Math - @inline - - @brief Converts string value to arithmetic value. - - @param [in] Str String to convert - - @return Arithmetic value - - @code - std::string str = "123.456"; - // To float - float f = ffw::stringToVal(str); - // To double - double d = ffw::stringToVal(str); - @endcode - */ - template inline T stringToVal(const std::string& Str); - - template <> inline float stringToVal (const std::string& Str){return std::stof(Str);} - template <> inline double stringToVal (const std::string& Str){return std::stod(Str);} - template <> inline long double stringToVal (const std::string& Str){return std::stold(Str);} - template <> inline short stringToVal (const std::string& Str){return std::stoi(Str);} - template <> inline int stringToVal (const std::string& Str){return std::stoi(Str);} - template <> inline long stringToVal (const std::string& Str){return std::stol(Str);} - template <> inline long long stringToVal (const std::string& Str){return std::stoll(Str);} - template <> inline unsigned short stringToVal (const std::string& Str){return (unsigned short)std::stoul(Str);} - template <> inline unsigned int stringToVal (const std::string& Str){return std::stoul(Str);} - template <> inline unsigned long stringToVal (const std::string& Str){return std::stoul(Str);} - template <> inline unsigned long long stringToVal (const std::string& Str){return std::stoull(Str);} - /*! - @memberof ffw - @ingroup Math - @inline - - @brief Converts arithmetic value to string. - - @param [in] value Value to convert - - @return std::string - */ - template inline std::string valToString(const T& Value){ - return std::to_string(Value); - } - /*! - @memberof ffw - @ingroup Math - @inline - - @brief Converts arithmetic value to string. - - @param [in] Value Value to convert - @param [in] Dec Number of decimals - - @return std::string - */ - template inline std::string valToString(T Value, unsigned int Dec){ - std::ostringstream ostr; - ostr.precision(Dec); - ostr << std::fixed << Value; - return ostr.str(); - } - /*! - @memberof ffw - @ingroup Math - @inline - - @brief Converts hex string value to arithmetic value. - - @param [in] Str String to convert - - @return Arithmetic value - */ - template inline T hexToVal(const std::string& Str) { - try { - return std::stoul(Str, nullptr, 16); - } catch (std::invalid_argument e){ - return 0; - } catch (std::out_of_range e){ - return 0; - } - return 0; - } - /*! - @memberof ffw - @ingroup Math - @inline - - @brief Converts arithmetic value to hex string. - - @param [in] Value Arithmetic value to convert - - @return Hex string - */ - template inline std::string valToHex(const T& Value) { - std::stringstream ss; - ss << std::hex << Value; - std::string h = ss.str(); - if(h.size() < sizeof(T)*2){ - return std::string(sizeof(T)*2 - h.size(), '0') + h; - } - return h; - } - /*! - @memberof ffw - @ingroup Math - @inline - - @brief Tokenize the string. - - @details Create tokens from string based on provided delimiter. - - @param [in] Line String to extract tokens from - @param [in] Delim Token delimiter - - @return std::vector of tokens - - @code - std::string str = " this is a sentence! "; - // Split string to tokens by space - std::vector tokens = ffw::getTokens(str, ' '); - // Print tokens - for(int i = 0; i < tokens.size(); i++){ - std::cout << "token: " << i << " = " << tokens[i] << std::endl; - } - // This will print: - // token: 0 = this - // token: 1 = is - // token: 2 = a - // token: 3 = sentence! - @endcode - */ - inline std::vector getTokens(const std::string& Line, char Delim){ - std::vector vec; - std::string temp = ""; - for(unsigned int i = 0; i < Line.size(); i++){ - if(Line[i] != Delim)temp += Line[i]; - else { - if(temp.size() > 0){ - vec.push_back(temp); - temp = ""; - } - } - if(i == Line.size()-1 && Line[i] != Delim)vec.push_back(temp); - } - return vec; - } - /*! - @memberof ffw - @ingroup Math - @inline - - @brief Converts multi-byte string to single-byte ANSI string. - - @param [in] Str Multi-byte string to convert - - @return Converted ANSI string - */ - inline std::string wstrToAnsi(std::wstring Str){ - int size = WideCharToMultiByte(CP_ACP, 0, Str.c_str(), Str.size(), NULL, 0, NULL, NULL); - std::string out(size, ' '); - WideCharToMultiByte(CP_ACP, 0, Str.c_str(), Str.size(), &out[0], size, 0, 0); - return out; - - } - /*! - @memberof ffw - @ingroup Math - @inline - - @brief Converts ANSI single-byte string to multi-byte string. - - @param [in] Str String to convert - - @return Converted multi-byte string - */ - inline std::wstring ansiToWstr(std::string Str){ - int size = MultiByteToWideChar(CP_ACP, 0, Str.c_str(), Str.size(), NULL, 0); - std::wstring out(size, L' '); - MultiByteToWideChar(CP_ACP, 0, Str.c_str(), Str.size(), &out[0], size); - return out; - } - /*! - @memberof ffw - @ingroup Math - @inline - - @brief Converts multi-byte string to single-byte UTF-8 string. - - @param [in] Str Multi-byte string to convert - - @return Converted UTF-8 string - */ - inline std::string wstrToUtf8(std::wstring Str){ - int size = WideCharToMultiByte(CP_UTF8, 0, Str.c_str(), Str.size(), NULL, 0, NULL, NULL); - std::string out(size, ' '); - WideCharToMultiByte(CP_UTF8, 0, Str.c_str(), Str.size(), &out[0], size, 0, 0); - return out; - - } - /*! - @memberof ffw - @ingroup Math - @inline - - @brief Converts UTF-8 single-byte string to multi-byte string. - - @param [in] Str String to convert - - @return Converted multi-byte string - */ - inline std::wstring utf8ToWstr(std::string Str){ - int size = MultiByteToWideChar(CP_UTF8, 0, Str.c_str(), Str.size(), NULL, 0); - std::wstring out(size, L' '); - MultiByteToWideChar(CP_UTF8, 0, Str.c_str(), Str.size(), &out[0], size); - return out; - } -}; - -#endif diff --git a/third-party-libs/FragmentFramework/include/math/typesOperators.h b/third-party-libs/FragmentFramework/include/math/typesOperators.h deleted file mode 100644 index 988cea5..0000000 --- a/third-party-libs/FragmentFramework/include/math/typesOperators.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_TYPE_OPERATORS -#define FFW_TYPE_OPERATORS - -/*! - @ingroup Math -*/ -namespace ffw{ - /*! - @memberof ffw - @ingroup Math - @inline - */ - template std::ostream& operator << (std::ostream& os, const vec2& V); - /*! - @memberof ffw - @ingroup Math - @inline - */ - template std::ostream& operator << (std::ostream& os, const vec3& V); - /*! - @memberof ffw - @ingroup Math - @inline - */ - template std::ostream& operator << (std::ostream& os, const vec4& V); - /*! - @memberof ffw - @ingroup Math - @inline - */ - std::ostream& operator << (std::ostream& os, const color& C); - /*! - @memberof ffw - @ingroup Math - @inline - */ - std::ostream& operator << (std::ostream& os, const quaternion& Q); -}; - -#include "typesOperators.inl" - -#endif diff --git a/third-party-libs/FragmentFramework/include/math/typesOperators.inl b/third-party-libs/FragmentFramework/include/math/typesOperators.inl deleted file mode 100644 index 295f88d..0000000 --- a/third-party-libs/FragmentFramework/include/math/typesOperators.inl +++ /dev/null @@ -1,43 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_TYPE_OPERATORS_INL -#define FFW_TYPE_OPERATORS_INL - -///============================================================================= -template -inline std::ostream& ffw::operator << (std::ostream& os, const ffw::vec2& V){ - os << V.x << ", " << V.y; - return os; -} - -///============================================================================= -template -inline std::ostream& ffw::operator << (std::ostream& os, const ffw::vec3& V){ - os << V.x << ", " << V.y << ", " << V.z; - return os; -} - -///============================================================================= -template -inline std::ostream& ffw::operator << (std::ostream& os, const ffw::vec4& V){ - os << V.x << ", " << V.y << ", " << V.z << ", " << V.w; - return os; -} - -///============================================================================= -inline std::ostream& ffw::operator << (std::ostream& os, const ffw::quaternion& Q){ - os << Q.x << ", " << Q.y << ", " << Q.z << ", " << Q.w; - return os; -} - -///============================================================================= -inline std::ostream& ffw::operator << (std::ostream& os, const ffw::color& C){ - os << C.r << ", " << C.g << ", " << C.b << ", " << C.a; - return os; -} - -#endif diff --git a/third-party-libs/FragmentFramework/include/renderContext.h b/third-party-libs/FragmentFramework/include/renderContext.h deleted file mode 100644 index 2dd6efc..0000000 --- a/third-party-libs/FragmentFramework/include/renderContext.h +++ /dev/null @@ -1,220 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_RENDER_CONTEXT -#define FFW_RENDER_CONTEXT - -#include "dll.h" -#include "window.h" -#include "gl/renderUtilities.h" -#include "gl/monitors.h" -#include "utilities/timer.h" - -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include - -/*! - @ingroup Core -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup Core - */ - bool FFW_API initGraphics(); - /*! - @memberof ffw - @ingroup Core - */ - void FFW_API terminateGraphics(); - /*! - @memberof ffw - @ingroup Core - @sa renderUtilities - @inherit renderUtilities - */ - class FFW_API renderContext : public renderUtilities { - public: - renderContext(); - ~renderContext(); - /*! - @memberof renderContext - @ingroup Core - */ - bool init(); - /*! - @memberof renderContext - @ingroup Core - */ - void destroy(); - /*! - @memberof renderContext - @ingroup Core - */ - void run(); - /*! - @memberof renderContext - @ingroup Core - */ - void stop(); - /*! - @memberof renderContext - @ingroup Core - */ - uint64_t getLastFrameTime(); - /*! - @memberof renderContext - @ingroup Core - */ - void setSwapInterval(int Interval); - /*! - @memberof renderContext - @ingroup Core - */ - bool showMouseCursor(window* Window); - /*! - @memberof renderContext - @ingroup Core - */ - bool hideMouseCursor(window* Window); - /*! - @memberof renderContext - @ingroup Core - */ - bool setMouseCursorPos(window* Window, int PosX, int PosY); - /*! - @memberof renderContext - @ingroup Core - */ - bool hideWindow(window* Window); - /*! - @memberof renderContext - @ingroup Core - */ - bool showWindow(window* Window); - /*! - @memberof renderContext - @ingroup Core - */ - bool iconifyWindow(window* Window); - /*! - @memberof renderContext - @ingroup Core - */ - bool restoreWindow(window* Window); - /*! - @memberof renderContext - @ingroup Core - */ - bool setWindowPos(window* Window, int PosX, int PosY); - /*! - @memberof renderContext - @ingroup Core - */ - bool setWindowSize(window* Window, int Width, int Height); - /*! - @memberof renderContext - @ingroup Core - */ - vec2i getWindowSize(window* Window); - /*! - @memberof renderContext - @ingroup Core - */ - vec2i getWindowPos(window* Window); - /*! - @memberof renderContext - @ingroup Core - */ - bool setWindowCursorCustomImage(window* Window, unsigned char* Pixels, int Width, int Height, int PosX, int PosY); - /*! - @memberof renderContext - @ingroup Core - */ - bool setWindowCursorCustom(window* Window); - /*! - @memberof renderContext - @ingroup Core - */ - bool setWindowCursorArrow(window* Window); - /*! - @memberof renderContext - @ingroup Core - */ - bool setWindowCursorIbeam(window* Window); - /*! - @memberof renderContext - @ingroup Core - */ - bool setWindowCursorCrosshair(window* Window); - /*! - @memberof renderContext - @ingroup Core - */ - bool setWindowCursorHand(window* Window); - /*! - @memberof renderContext - @ingroup Core - */ - bool setWindowCursorHResize(window* Window); - /*! - @memberof renderContext - @ingroup Core - */ - bool setWindowCursorVresize(window* Window); - /*! - @memberof renderContext - @ingroup Core - */ - bool addWindow(window* Window, bool Resizable, bool Decorated, bool Iconify, bool Floating, bool Focused, int PosX, int PosY, int Width, int Height, std::string Title, monitor* Monitor); - private: - static void keyPressedCB (GLFWwindow* windowContext, int key, int scancode, int action, int mods); - static void textInputCB (GLFWwindow* windowContext, unsigned int key); - static void mouseMovedCB (GLFWwindow* windowContext, double xpos, double ypos); - static void mouseButtonPressedCB (GLFWwindow* windowContext, int button,int action, int mods); - static void mouseScrolledCB (GLFWwindow* windowContext, double xoffset, double yoffset); - static void windowShouldCloseCB (GLFWwindow* windowContext); - static void windowMovedCB (GLFWwindow* windowContext, int xpos, int ypos); - static void windowFocusCB (GLFWwindow* windowContext, int focus); - static void filesFroppedCB (GLFWwindow* windowContext, int count, const char** files); - - //renderer activeRenderer; - GLFWwindow* defaultWindowContext; - - struct wrapper{ - window* windowPtr; - GLFWwindow* windowContext; - int windowWidth; - int windowHeight; - bool visible; - GLFWcursor* windowCursor; - GLFWcursor* windowCursorArrow; - GLFWcursor* windowCursorIbeam; - GLFWcursor* windowCursorCrosshair; - GLFWcursor* windowCursorHand; - GLFWcursor* windowCursorHresize; - GLFWcursor* windowCursorVresize; - int cursorX; - int cursorY; - }; - - PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL; - PFNWGLGETSWAPINTERVALEXTPROC wglGetSwapIntervalEXT = NULL; - - std::vector windows; - - bool initialized; - bool runRenderer; - uint64_t lastFrameTime; - }; -}; -#endif diff --git a/third-party-libs/FragmentFramework/include/userInterface/callback.h b/third-party-libs/FragmentFramework/include/userInterface/callback.h deleted file mode 100644 index 5c4192c..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/callback.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_CALLBACK -#define FFW_UI_CALLBACK - -#include "event.h" - -namespace ffw { - class callbackInterface { - public: - virtual ~callbackInterface(){} - virtual void execute(const uiEvent& Event) = 0; - }; - - template class callback: public callbackInterface { - public: - callback(void (T::*Func)(const uiEvent&), T* Instance):funcMem(Func), instance(Instance), isMem(true){} - callback(void (*Func)(const uiEvent&)):func(Func), instance(NULL), isMem(false){} - - void execute(const uiEvent& Event) override { - if(isMem) - (instance->*funcMem)(Event); - else - func(Event); - } - private: - void (T::*funcMem)(const uiEvent&); - void (*func)(const uiEvent&); - T* instance; - bool isMem; - }; -} - -#endif - diff --git a/third-party-libs/FragmentFramework/include/userInterface/canvas.h b/third-party-libs/FragmentFramework/include/userInterface/canvas.h deleted file mode 100644 index e43fd3c..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/canvas.h +++ /dev/null @@ -1,144 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_CANVAS -#define FFW_UI_CANVAS - -#include "../dll.h" -#include "widget.h" -#include "event.h" -#include "callback.h" - -#include "../math/stringMath.h" -#include "../math/math.h" -#include "../graphics/bufferObject.h" - -/*! - @ingroup User-Interface -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup User-Interface - */ - class FFW_API uiCanvas { - public: - uiCanvas(); - bool init(); - void destroy(); - /*! - @memberof uiCanvas - @ingroup User-Interface - */ - void deleteAllWidgets(); - /*! - @memberof uiCanvas - @ingroup User-Interface - */ - uiWidget* addWidget(uiWidget* Widget); - void bind(); - void unbind(); - void updateBuffers(); - void updateUserInput(); - /*! - @memberof uiCanvas - @ingroup User-Interface - */ - void injectMousePos(int MouseX, int MouseY); - /*! - @memberof uiCanvas - @ingroup User-Interface - */ - void injectMouseButtonPressed(int Button); - /*! - @memberof uiCanvas - @ingroup User-Interface - */ - void injectMouseButtonReleased(int Button); - /*! - @memberof uiCanvas - @ingroup User-Interface - */ - void injectKeyPressed(int Key, int Mode); - /*! - @memberof uiCanvas - @ingroup User-Interface - */ - void injectTextInput(int C); - /*! - @memberof uiCanvas - @ingroup User-Interface - */ - void resetUserInput(); - uint32_t getBufferSize() const; - bool isBufferLoaded() const; - /*! - @memberof uiCanvas - @ingroup User-Interface - */ - void setPos(int PosX, int PosY); - /*! - @memberof uiCanvas - @ingroup User-Interface - */ - void setSize(int Width, int Height); - /*! - @memberof uiCanvas - @ingroup User-Interface - */ - void setOffset(int OffsetX, int OffsetY); - /*! - @memberof uiCanvas - @ingroup User-Interface - */ - void setVisible(bool Visibility); - /*! - @memberof uiCanvas - @ingroup User-Interface - */ - const ffw::vec2i& getPos() const; - /*! - @memberof uiCanvas - @ingroup User-Interface - */ - const ffw::vec2i& getSize() const; - /*! - @memberof uiCanvas - @ingroup User-Interface - */ - const ffw::vec2i& getOffset() const; - /*! - @memberof uiCanvas - @ingroup User-Interface - */ - bool isVisible() const; - void setDataPtr(uiSharedData* SharedData); - void poolEvents(std::vector& Listeners); - - private: - void recreateVbo(); - - ffw::bufferObject vbo; - struct widgetWrapper { - uiWidget* ptr; - uint32_t bufferOffset; - }; - std::vector widgetsStaticVec; - std::vector widgetsDynamicVec; - int mouseX; - int mouseY; - - ffw::vec2i size; - ffw::vec2i pos; - ffw::vec2i offset; - uiSharedData* sharedData; - int eventsQueueSize; - bool visible; - }; -}; - -#endif - diff --git a/third-party-libs/FragmentFramework/include/userInterface/constructor.h b/third-party-libs/FragmentFramework/include/userInterface/constructor.h deleted file mode 100644 index 324d1b6..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/constructor.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_USER_INTERFACE_CONSTRUCTOR -#define FFW_USER_INTERFACE_CONSTRUCTOR - -#include -#include "../dll.h" -#include "../math/math.h" -#include "../graphics/graphicsTrueType.h" -#include "tileData.h" - -namespace ffw { - namespace uiConstruct { - void FFW_API box(float* Ptr, const ffw::vec2f& Pos, const ffw::vec2f& Size, const ffw::vec4f& Top, const ffw::vec4f& Bottom, const ffw::vec4f& Left, const ffw::vec4f& Right, const ffw::vec4f& Middle, const ffw::vec4f& TopLeft, const ffw::vec4f& TopRight, const ffw::vec4f& BottomLeft, const ffw::vec4f& BottomRight, int* TileData); - void FFW_API boxHorizontal(float* Ptr, const ffw::vec2f& Pos, const ffw::vec2f& Size, const ffw::vec4f& TileLeft, const ffw::vec4f& TileMiddle, const ffw::vec4f& TileRight, int* TileData); - void FFW_API boxVertical(float* Ptr, const ffw::vec2f& Pos, const ffw::vec2f& Size, const ffw::vec4f& TileBottom, const ffw::vec4f& TileMiddle, const ffw::vec4f& TileTop, int* TileData); - void FFW_API boxSingle(float* Ptr, const ffw::vec2f& Pos, const ffw::vec2f& Size, const ffw::vec4f& Tile, float TileData); - void FFW_API boxSingle(float* Ptr, const ffw::vec2f& Pos, const ffw::vec2f& Size, const ffw::vec4f& Tile, float TileData, const ffw::color& Color); - void FFW_API boxSingle(float* Ptr, const ffw::vec2f& Pos, const ffw::vec2f& Size, const ffw::vec4f& Tile, float TileData, const ffw::color& Color, const ffw::vec2f& AtlasSize); - void FFW_API text(float* Ptr, const ffw::vec2f& Pos, const std::wstring& Str, const ffw::color& Color, ffw::trueType* Font); - void FFW_API text(float* Ptr, const ffw::vec2f& Pos, const std::wstring& Str, const ffw::color& Color, ffw::trueType* Font, size_t Start, size_t End); - }; -}; - -#endif - - - diff --git a/third-party-libs/FragmentFramework/include/userInterface/event.h b/third-party-libs/FragmentFramework/include/userInterface/event.h deleted file mode 100644 index 097db49..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/event.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_EVENT -#define FFW_UI_EVENT - -/*! - @ingroup User-Interface -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup User-Interface - */ - class uiEvent { - public: - virtual ~uiEvent(){} - /*! - @memberof uiEvent - @ingroup User-Interface - */ - enum type { - none, - pressed, - selected, - value - }; - - /*! - @memberof uiEvent - @ingroup User-Interface - */ - uiEvent(type Type, uiWidget* Widget){ - eventType = Type; - widget = Widget; - } - /*! - @memberof uiEvent - @ingroup User-Interface - */ - type getType() const { - return eventType; - } - /*! - @memberof uiEvent - @ingroup User-Interface - */ - uiWidget* getWidget() const { - return widget; - } - private: - type eventType; - uiWidget* widget; - }; -} - -#endif diff --git a/third-party-libs/FragmentFramework/include/userInterface/manager.h b/third-party-libs/FragmentFramework/include/userInterface/manager.h deleted file mode 100644 index 8634595..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/manager.h +++ /dev/null @@ -1,206 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_MANAGER -#define FFW_UI_MANAGER - -#include "window.h" - -#include "../dll.h" -#include "../math/stringMath.h" -#include "../math/math.h" -#include "../graphics/graphicsTexture2D.h" -#include "../graphics/graphicsShader.h" -#include "../graphics/graphicsTrueType.h" -#include "../utilities/timer.h" - -#include -#include - -/*! - @ingroup User-Interface -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup User-Interface - */ - class FFW_API uiManager { - public: - uiManager(); - ~uiManager(); - /*! - @memberof uiManager - @ingroup User-Interface - */ - bool init(); - /*! - @memberof uiManager - @ingroup User-Interface - */ - void destroy(); - /*! - @memberof uiManager - @ingroup User-Interface - */ - void deleteAllWindows(); - /*! - @memberof uiManager - @ingroup User-Interface - */ - bool loadTileTexture(const std::string& Path); - /*! - @memberof uiManager - @ingroup User-Interface - */ - bool loadIconsTexture(const std::string& Path); - /*! - @memberof uiManager - @ingroup User-Interface - */ - ffw::texture2D* createIconsTexture(int Size); - /*! - @memberof uiManager - @ingroup User-Interface - */ - int loadIconsData(const std::string& Path, int Size); - /*! - @memberof uiManager - @ingroup User-Interface - */ - bool loadImagesTexture(const std::string& Path); - /*! - @memberof uiManager - @ingroup User-Interface - */ - ffw::texture2D* createImagesTexture(int Size); - /*! - @memberof uiManager - @ingroup User-Interface - */ - int loadImagesData(const std::string& Path); - /*! - @memberof uiManager - @ingroup User-Interface - */ - bool addImageData(const std::string& Name, int PosX, int PosY, int Width, int Height); - /*! - @memberof uiManager - @ingroup User-Interface - */ - bool loadFont(const std::string& Path, int Points, int Dpi); - /*! - @memberof uiManager - @ingroup User-Interface - */ - void draw(); - /*! - @memberof uiManager - @ingroup User-Interface - */ - void update(); - /*! - @memberof uiManager - @ingroup User-Interface - */ - void setViewport(int PosX, int PosY, int Width, int Height); - /*! - @memberof uiManager - @ingroup User-Interface - */ - void injectMousePos(int MouseX, int MouseY); - /*! - @memberof uiManager - @ingroup User-Interface - */ - void injectMouseButtonPressed(int Button); - /*! - @memberof uiManager - @ingroup User-Interface - */ - void injectMouseButtonReleased(int Button); - /*! - @memberof uiManager - @ingroup User-Interface - */ - void injectKeyPressed(int Key, int Mode); - /*! - @memberof uiManager - @ingroup User-Interface - */ - void injectTextInput(int C); - /*! - @memberof uiManager - @ingroup User-Interface - */ - uiWindow* addWindow(int PosX, int PosY, int Width, int Height, const std::wstring& Title, bool Tilebar, bool Closeable, bool Background); - /*! - @memberof uiManager - @ingroup User-Interface - */ - uiColors* getColors(); - /*! - @memberof uiManager - @ingroup User-Interface - */ - void setTilebarTextColor(const ffw::color& Color); - /*! - @memberof uiManager - @ingroup User-Interface - */ - void poolEventsAll(); - - private: - void checkWindowOrder(); - void checkHoverIndex(); - - ffw::texture2D tileTexture; - ffw::texture2D iconTexture; - ffw::texture2D imageTexture; - ffw::shader tileShader; - uiSharedData sharedData; - ffw::trueType font; - std::vector windowsVec; - std::vector windowsIndex; - ffw::mat4 MVP; - bool initialized; - - ffw::vec2i injectedMousePos; - bool updateInjectedMousePos; - int injectedMouseButtonPressed; - int injectedMouseButtonReleased; - bool updateInjectedMouseButtonPressed; - bool updateInjectedMouseButtonReleased; - int injectedKeyPressed; - int injectedKeyPressedMode; - bool updateInjectedKeyPressed; - int injectedTextInput; - bool updateInjectedTextInput; - - bool windowMoving; - ffw::vec2i windowMovingPosOld; - int windowMovingIndex; - int windowHoverIndex; - int windowHoverIndexOld; - int windowActiveIndex; - - int shaderViewLoc; - int shaderSamplerTilesLoc; - int shaderSamplerFontLoc; - int shaderSamplerIconLoc; - int shaderSamplerImageLoc; - int shaderPositionLoc; - int shaderTexCoordsLoc; - int shaderColorLoc; - int shaderOffsetLoc; - int viewportWidth; - int viewportHeight; - - PFNGLACTIVETEXTUREPROC glActiveTexture; - }; -}; - -#endif diff --git a/third-party-libs/FragmentFramework/include/userInterface/shaderData.h b/third-party-libs/FragmentFramework/include/userInterface/shaderData.h deleted file mode 100644 index 8ce5f45..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/shaderData.h +++ /dev/null @@ -1,19 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_SHADER_DATA -#define FFW_UI_SHADER_DATA - -#include - -namespace shaderData { - extern std::string uiShaderVert; - extern std::string uiShaderFrag; -}; - -#endif - - diff --git a/third-party-libs/FragmentFramework/include/userInterface/sharedData.h b/third-party-libs/FragmentFramework/include/userInterface/sharedData.h deleted file mode 100644 index ecf7bb4..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/sharedData.h +++ /dev/null @@ -1,103 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_SHARED_DATA -#define FFW_UI_SHARED_DATA - -#include "../math/math.h" -#include "../graphics/graphicsTexture2D.h" -#include "../graphics/graphicsShader.h" -#include "../graphics/graphicsTrueType.h" - -/*! - @ingroup User-Interface -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup User-Interface - */ - struct uiColors { - /*! - @memberof uiColors - @ingroup User-Interface - */ - ffw::color buttonIconColorNormal; - /*! - @memberof uiColors - @ingroup User-Interface - */ - ffw::color buttonIconColorHover; - /*! - @memberof uiColors - @ingroup User-Interface - */ - ffw::color buttonIconColorActive; - /*! - @memberof uiColors - @ingroup User-Interface - */ - ffw::color buttonTextColorNormal; - /*! - @memberof uiColors - @ingroup User-Interface - */ - ffw::color buttonTextColorHover; - /*! - @memberof uiColors - @ingroup User-Interface - */ - ffw::color buttonTextColorActive; - /*! - @memberof uiColors - @ingroup User-Interface - */ - ffw::color textInputTextColorNormal; - /*! - @memberof uiColors - @ingroup User-Interface - */ - ffw::color textInputTextColorFocus; - /*! - @memberof uiColors - @ingroup User-Interface - */ - ffw::color tilebarFontColor; - /*! - @memberof uiColors - @ingroup User-Interface - */ - ffw::color listItemColor; - }; - - class uiSharedData { - public: - uiSharedData(); - uiColors colors; - ffw::trueType* font; - - void setIconSize(int Size); - void addIcon(const std::string& Name, int PosX, int PosY); - void addImage(const std::string& Name, int PosX, int PosY, int Width, int Height); - const ffw::vec4f& getIcon(const std::string& Name); - const ffw::vec4f& getImage(const std::string& Name); - - ffw::vec2f imagesAtlasSize; - ffw::vec2f iconsAtlasSize; - private: - std::map icons; - std::map images; - float iconSize; - ffw::vec4f nullIcon; - ffw::vec4f nullImage; - }; -}; - -#endif - - - - diff --git a/third-party-libs/FragmentFramework/include/userInterface/tileData.h b/third-party-libs/FragmentFramework/include/userInterface/tileData.h deleted file mode 100644 index 651753a..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/tileData.h +++ /dev/null @@ -1,169 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_TILE_DATA -#define FFW_UI_TILE_DATA - -#include - -#include "../math/math.h" - -namespace tileData { - extern ffw::vec2f textureSize; - - extern int boxDefaultTiles[9]; - extern ffw::vec4f boxDefaultTop; - extern ffw::vec4f boxDefaultBottom; - extern ffw::vec4f boxDefaultLeft; - extern ffw::vec4f boxDefaultRight; - extern ffw::vec4f boxDefaultMiddle; - extern ffw::vec4f boxDefaultTopLeft; - extern ffw::vec4f boxDefaultTopRight; - extern ffw::vec4f boxDefaultBottomLeft; - extern ffw::vec4f boxDefaultBottomRight; - - extern int boxListTiles[9]; - extern ffw::vec4f boxListTop; - extern ffw::vec4f boxListBottom; - extern ffw::vec4f boxListLeft; - extern ffw::vec4f boxListRight; - extern ffw::vec4f boxListMiddle; - extern ffw::vec4f boxListTopLeft; - extern ffw::vec4f boxListTopRight; - extern ffw::vec4f boxListBottomLeft; - extern ffw::vec4f boxListBottomRight; - extern int boxListSelectedTile; - extern ffw::vec4f boxListSelected; - - extern int buttonNormalTiles[3]; - extern ffw::vec4f buttonNormalLeft; - extern ffw::vec4f buttonNormalMiddle; - extern ffw::vec4f buttonNormalRight; - - extern int buttonHoverTiles[3]; - extern ffw::vec4f buttonHoverLeft; - extern ffw::vec4f buttonHoverMiddle; - extern ffw::vec4f buttonHoverRight; - - extern int buttonActiveTiles[3]; - extern ffw::vec4f buttonActiveLeft; - extern ffw::vec4f buttonActiveMiddle; - extern ffw::vec4f buttonActiveRight; - - extern int lineHorizontalTiles[3]; - extern ffw::vec4f lineHorizontalLeft; - extern ffw::vec4f lineHorizontalMiddle; - extern ffw::vec4f lineHorizontalRight; - - extern int lineVerticalTiles[3]; - extern ffw::vec4f lineVerticalLeft; - extern ffw::vec4f lineVerticalMiddle; - extern ffw::vec4f lineVerticalRight; - - extern int iconTiles[3]; - extern ffw::vec4f iconNormal; - extern ffw::vec4f iconHover; - extern ffw::vec4f iconActive; - - extern int switchHorizontalTiles[2]; - extern ffw::vec4f switchHorizontalOff; - extern ffw::vec4f switchHorizontalOn; - - extern int switchVerticalTiles[2]; - extern ffw::vec4f switchVerticalOff; - extern ffw::vec4f switchVerticalOn; - - extern int checkboxOffTiles[3]; - extern ffw::vec4f checkboxOffNormal; - extern ffw::vec4f checkboxOffHover; - extern ffw::vec4f checkboxOffActive; - - extern int checkboxOnTiles[3]; - extern ffw::vec4f checkboxOnNormal; - extern ffw::vec4f checkboxOnHover; - extern ffw::vec4f checkboxOnActive; - - extern int progressbarFrontTiles[3]; - extern ffw::vec4f progressbarFrontLeft; - extern ffw::vec4f progressbarFrontMiddle; - extern ffw::vec4f progressbarFrontRight; - - extern int progressbarBackTiles[3]; - extern ffw::vec4f progressbarBackLeft; - extern ffw::vec4f progressbarBackMiddle; - extern ffw::vec4f progressbarBackRight; - - extern int sliderHorizontalFrontTiles[3]; - extern ffw::vec4f sliderHorizontalFrontLeft; - extern ffw::vec4f sliderHorizontalFrontMiddle; - extern ffw::vec4f sliderHorizontalFrontRight; - - extern int sliderHorizontalBackTiles[3]; - extern ffw::vec4f sliderHorizontalBackLeft; - extern ffw::vec4f sliderHorizontalBackMiddle; - extern ffw::vec4f sliderHorizontalBackRight; - - extern int sliderVerticalFrontTiles[3]; - extern ffw::vec4f sliderVerticalFrontLeft; - extern ffw::vec4f sliderVerticalFrontMiddle; - extern ffw::vec4f sliderVerticalFrontRight; - - extern int sliderVerticalBackTiles[3]; - extern ffw::vec4f sliderVerticalBackLeft; - extern ffw::vec4f sliderVerticalBackMiddle; - extern ffw::vec4f sliderVerticalBackRight; - - extern int sliderKnobTiles[3]; - extern ffw::vec4f sliderKnobNormal; - extern ffw::vec4f sliderKnobHover; - extern ffw::vec4f sliderKnobActive; - - extern int scrollerHorizontalTiles[3]; - extern ffw::vec4f scrollerHorizontalLeft; - extern ffw::vec4f scrollerHorizontalMiddle; - extern ffw::vec4f scrollerHorizontalRight; - - extern int scrollerVerticalTiles[3]; - extern ffw::vec4f scrollerVerticalLeft; - extern ffw::vec4f scrollerVerticalMiddle; - extern ffw::vec4f scrollerVerticalRight; - - extern int scrollerHorizontalKnobTiles[3]; - extern ffw::vec4f scrollerHorizontalKnobNormal; - extern ffw::vec4f scrollerHorizontalKnobHover; - extern ffw::vec4f scrollerHorizontalKnobActive; - - extern int scrollerVerticalKnobTiles[3]; - extern ffw::vec4f scrollerVerticalKnobNormal; - extern ffw::vec4f scrollerVerticalKnobHover; - extern ffw::vec4f scrollerVerticalKnobActive; - - extern int textInputNormalTiles[3]; - extern ffw::vec4f textInputNormalLeft; - extern ffw::vec4f textInputNormalMiddle; - extern ffw::vec4f textInputNormalRight; - - extern int textInputFocusTiles[3]; - extern ffw::vec4f textInputFocusLeft; - extern ffw::vec4f textInputFocusMiddle; - extern ffw::vec4f textInputFocusRight; - - extern ffw::vec4f iconArrowDown; - extern ffw::vec4f iconArrowLeft; - extern ffw::vec4f iconArrowRight; - extern ffw::vec4f iconArrowUp; - extern ffw::vec4f iconArrows; - extern ffw::vec4f iconPlus; - extern ffw::vec4f iconMinus; - extern ffw::vec4f iconTriangle; - extern ffw::vec4f iconCheck; - extern ffw::vec4f iconCross; - extern ffw::vec4f iconCircle; -}; - -#endif - - diff --git a/third-party-libs/FragmentFramework/include/userInterface/widget.h b/third-party-libs/FragmentFramework/include/userInterface/widget.h deleted file mode 100644 index cffdec9..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/widget.h +++ /dev/null @@ -1,201 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_WIDGET -#define FFW_UI_WIDGET - -#include "../dll.h" -#include "constructor.h" -#include "sharedData.h" -#include "../math/stringMath.h" -#include "../systemUtils/win32SysUtils.h" - -namespace ffw { - class uiWidget; -}; - -#include "event.h" - -/*! - @ingroup User-Interface -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup User-Interface - */ - class FFW_API uiWidget { - public: - uiWidget(const std::string& ID); - virtual ~uiWidget() {}; - /*! - @memberof uiWidget - @ingroup User-Interface - */ - virtual void update() = 0; - /*! - @memberof uiWidget - @ingroup User-Interface - */ - void setSize(float Width, float Height); - /*! - @memberof uiWidget - @ingroup User-Interface - */ - void setPos(float PosX, float PosY); - /*! - @memberof uiWidget - @ingroup User-Interface - */ - const ffw::vec2f& getSize() const; - /*! - @memberof uiWidget - @ingroup User-Interface - */ - const ffw::vec2f& getPos() const; - /*! - @memberof uiWidget - @ingroup User-Interface - */ - const std::string& getID() const; - uint32_t getBufferSize() const; - const float* getBuffer() const; - uiEvent::type getEvent(); - /*! - @memberof uiWidget - @ingroup User-Interface - */ - bool isStatic() const; - bool shouldUpdateBuffer(); - bool shouldUpdate(); - void setDataPtr(uiSharedData* SharedData); - /*! - @memberof uiWidget - @ingroup User-Interface - */ - virtual void hover(bool Hover); - /*! - @memberof uiWidget - @ingroup User-Interface - */ - virtual void mousePressed(int Button, int PosX, int PosY); - /*! - @memberof uiWidget - @ingroup User-Interface - */ - virtual void mouseReleased(int Button); - /*! - @memberof uiWidget - @ingroup User-Interface - */ - virtual void focus(bool Focus); - /*! - @memberof uiWidget - @ingroup User-Interface - */ - virtual void keyPressed(int Key, int Mode); - /*! - @memberof uiWidget - @ingroup User-Interface - */ - virtual void textInput(int C); - /*! - @memberof uiWidget - @ingroup User-Interface - */ - virtual void mousePos(int PosX, int PosY); - /*! - @memberof uiWidget - @ingroup User-Interface - */ - bool hasHover(); - /*! - @memberof uiWidget - @ingroup User-Interface - */ - bool hasFocus(); - - protected: - /*! - @memberof uiWidget - @ingroup User-Interface - @protected - */ - void pushEvent(uiEvent::type EventType); - /*! - @memberof uiWidget - @ingroup User-Interface - @protected - */ - uiSharedData* sharedData; - /*! - @memberof uiWidget - @ingroup User-Interface - @protected - */ - bool updateBufferFlag; - /*! - @memberof uiWidget - @ingroup User-Interface - @protected - */ - bool updateFlag; - /*! - @memberof uiWidget - @ingroup User-Interface - @protected - */ - bool isStaticFlag; - /*! - @memberof uiWidget - @ingroup User-Interface - @protected - */ - uint32_t bufferSize; - /*! - @memberof uiWidget - @ingroup User-Interface - @protected - */ - float* bufferVertices; - /*! - @memberof uiWidget - @ingroup User-Interface - @protected - */ - bool hoverFlag; - /*! - @memberof uiWidget - @ingroup User-Interface - @protected - */ - bool focusFlag; - uiEvent::type currentEvent; - /*! - @memberof uiWidget - @ingroup User-Interface - @protected - */ - std::string id; - /*! - @memberof uiWidget - @ingroup User-Interface - @protected - */ - ffw::vec2f size; - /*! - @memberof uiWidget - @ingroup User-Interface - @protected - */ - ffw::vec2f pos; - - }; -}; - -#endif - - diff --git a/third-party-libs/FragmentFramework/include/userInterface/widgetBox.h b/third-party-libs/FragmentFramework/include/userInterface/widgetBox.h deleted file mode 100644 index becce4d..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/widgetBox.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_WIDGET_BOX -#define FFW_UI_WIDGET_BOX - -#include "widget.h" - -/*! - @ingroup User-Interface -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup User-Interface - @inherit uiWidget - @sa uiWidget - */ - class FFW_API uiWidgetBox : public uiWidget { - public: - /*! - @memberof uiWidgetBox - @ingroup User-Interface - */ - uiWidgetBox(float PosX, float PosY, float Width, float Height); - ~uiWidgetBox(); - /*! - @memberof uiWidgetBox - @ingroup User-Interface - */ - void update() override; - }; -}; - -#endif - - - diff --git a/third-party-libs/FragmentFramework/include/userInterface/widgetButton.h b/third-party-libs/FragmentFramework/include/userInterface/widgetButton.h deleted file mode 100644 index 0c61f00..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/widgetButton.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_WIDGET_BUTTON -#define FFW_UI_WIDGET_BUTTON - -#include "widget.h" - -/*! - @ingroup User-Interface -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup User-Interface - @inherit uiWidget - @sa uiWidget - */ - class FFW_API uiWidgetButton : public uiWidget { - public: - /*! - @memberof uiWidgetButton - @ingroup User-Interface - */ - uiWidgetButton(const std::string& ID, float PosX, float PosY, float Width, float Height, const std::wstring& Text); - ~uiWidgetButton(); - - void update() override; - void hover(bool Hover) override; - void mousePressed(int Button, int PosX, int PosY) override; - void mouseReleased(int Button) override; - - private: - float* bufferNormal; - float* bufferHover; - float* bufferActive; - int textSize; - std::wstring text; - }; -}; - -#endif - - - - diff --git a/third-party-libs/FragmentFramework/include/userInterface/widgetButtonIcon.h b/third-party-libs/FragmentFramework/include/userInterface/widgetButtonIcon.h deleted file mode 100644 index 4dda9f6..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/widgetButtonIcon.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_WIDGET_BUTTON_ICON -#define FFW_UI_WIDGET_BUTTON_ICON - -#include "widget.h" - -/*! - @ingroup User-Interface -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup User-Interface - @inherit uiWidget - @sa uiWidget - */ - class FFW_API uiWidgetButtonIcon : public uiWidget { - public: - /*! - @memberof uiWidgetButtonIcon - @ingroup User-Interface - */ - uiWidgetButtonIcon(const std::string& ID, float PosX, float PosY, float Width, float Height, const std::string& IconName, int Padding); - uiWidgetButtonIcon(const std::string& ID, float PosX, float PosY, float Width, float Height, const ffw::vec4f& IconTile, int Padding); - ~uiWidgetButtonIcon(); - - void update() override; - void hover(bool Hover) override; - void mousePressed(int Button, int PosX, int PosY) override; - void mouseReleased(int Button) override; - - private: - float* bufferNormal; - float* bufferHover; - float* bufferActive; - std::string iconName; - ffw::vec4f iconTile; - int padding; - }; -}; - -#endif - - - - - diff --git a/third-party-libs/FragmentFramework/include/userInterface/widgetCheckbox.h b/third-party-libs/FragmentFramework/include/userInterface/widgetCheckbox.h deleted file mode 100644 index ef2897c..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/widgetCheckbox.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_WIDGET_CHECKBOX -#define FFW_UI_WIDGET_CHECKBOX - -#include "widget.h" - -/*! - @ingroup User-Interface -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup User-Interface - @inherit uiWidget - @sa uiWidget - */ - class FFW_API uiWidgetCheckbox : public uiWidget { - public: - /*! - @memberof uiWidgetCheckbox - @ingroup User-Interface - */ - uiWidgetCheckbox(const std::string& ID, float PosX, float PosY, float Size, bool Value); - ~uiWidgetCheckbox(); - - void update() override; - void hover(bool Hover) override; - void mousePressed(int Button, int PosX, int PosY) override; - void mouseReleased(int Button) override; - /*! - @memberof uiWidgetCheckbox - @ingroup User-Interface - */ - void setValue(bool Value); - /*! - @memberof uiWidgetCheckbox - @ingroup User-Interface - */ - bool getValue() const; - - private: - float* bufferOnNormal; - float* bufferOnHover; - float* bufferOnActive; - float* bufferOffNormal; - float* bufferOffHover; - float* bufferOffActive; - bool value; - }; -}; - -#endif - - - - - - - diff --git a/third-party-libs/FragmentFramework/include/userInterface/widgetIcon.h b/third-party-libs/FragmentFramework/include/userInterface/widgetIcon.h deleted file mode 100644 index e9c3b99..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/widgetIcon.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_WIDGET_ICON -#define FFW_UI_WIDGET_ICON - -#include "widget.h" - -/*! - @ingroup User-Interface -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup User-Interface - @inherit uiWidget - @sa uiWidget - */ - class FFW_API uiWidgetIcon : public uiWidget { - public: - /*! - @memberof uiWidgetIcon - @ingroup User-Interface - */ - uiWidgetIcon(float PosX, float PosY, float Width, float Height, const std::string& IconName, const ffw::color& Color); - uiWidgetIcon(float PosX, float PosY, float Width, float Height, const ffw::vec4f& IconTile, const ffw::color& Color); - ~uiWidgetIcon(); - - void update() override; - - private: - std::string iconName; - ffw::vec4f iconTile; - ffw::color iconColor; - }; -}; - -#endif - - - - diff --git a/third-party-libs/FragmentFramework/include/userInterface/widgetImage.h b/third-party-libs/FragmentFramework/include/userInterface/widgetImage.h deleted file mode 100644 index 49144ef..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/widgetImage.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_WIDGET_IMAGE -#define FFW_UI_WIDGET_IMAGE - -#include "widget.h" - -/*! - @ingroup User-Interface -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup User-Interface - @inherit uiWidget - @sa uiWidget - */ - class FFW_API uiWidgetImage : public uiWidget { - public: - /*! - @memberof uiWidgetImage - @ingroup User-Interface - */ - uiWidgetImage(float PosX, float PosY, float Width, float Height, const std::string& ImageName, const ffw::color& TintColor); - ~uiWidgetImage(); - - void update() override; - - void mousePressed(int Button, int PosX, int PosY) override; - void mouseReleased(int Button) override; - - private: - std::string imageName; - ffw::color tintColor; - }; -}; - -#endif - - - - - diff --git a/third-party-libs/FragmentFramework/include/userInterface/widgetImageDynamic.h b/third-party-libs/FragmentFramework/include/userInterface/widgetImageDynamic.h deleted file mode 100644 index 162e042..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/widgetImageDynamic.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_WIDGET_IMAGE_DYNAMIC -#define FFW_UI_WIDGET_IMAGE_DYNAMIC - -#include "widget.h" - -/*! - @ingroup User-Interface -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup User-Interface - @inherit uiWidget - @sa uiWidget - */ - class FFW_API uiWidgetImageDynamic : public uiWidget { - public: - /*! - @memberof uiWidgetImageDynamic - @ingroup User-Interface - */ - uiWidgetImageDynamic(const std::string& ID, float PosX, float PosY, float Width, float Height, const std::string& ImageName, const ffw::color& TintColor); - ~uiWidgetImageDynamic(); - - void update() override; - - void mousePressed(int Button, int PosX, int PosY) override; - void mouseReleased(int Button) override; - - private: - std::string imageName; - ffw::color tintColor; - }; -}; - -#endif - - - - - - diff --git a/third-party-libs/FragmentFramework/include/userInterface/widgetLabel.h b/third-party-libs/FragmentFramework/include/userInterface/widgetLabel.h deleted file mode 100644 index 78bc56e..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/widgetLabel.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_WIDGET_LABEL -#define FFW_UI_WIDGET_LABEL - -#include "widget.h" - -/*! - @ingroup User-Interface -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup User-Interface - @inherit uiWidget - @sa uiWidget - */ - class FFW_API uiWidgetLabel : public uiWidget { - public: - /*! - @memberof uiWidgetLabel - @ingroup User-Interface - */ - uiWidgetLabel(float PosX, float PosY, const std::wstring& Text, int Aligment, const ffw::color& Color); - uiWidgetLabel(float PosX, float PosY, const std::wstring& Text, int Aligment, const ffw::color& Color, int Wrap); - ~uiWidgetLabel(); - - void update() override; - - private: - std::wstring text; - int aligment; - int wrap; - ffw::color textColor; - }; -}; - -#endif - - - - - diff --git a/third-party-libs/FragmentFramework/include/userInterface/widgetLine.h b/third-party-libs/FragmentFramework/include/userInterface/widgetLine.h deleted file mode 100644 index b5a9d7e..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/widgetLine.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_WIDGET_LINE -#define FFW_UI_WIDGET_LINE - -#include "widget.h" - -/*! - @ingroup User-Interface -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup User-Interface - @inherit uiWidget - @sa uiWidget - */ - class FFW_API uiWidgetLine : public uiWidget { - public: - /*! - @memberof uiWidgetLine - @ingroup User-Interface - */ - uiWidgetLine(float PosX, float PosY, float Width, bool Vertical); - ~uiWidgetLine(); - - void update() override; - - private: - bool vertical; - }; -}; - -#endif - - - - diff --git a/third-party-libs/FragmentFramework/include/userInterface/widgetList.h b/third-party-libs/FragmentFramework/include/userInterface/widgetList.h deleted file mode 100644 index 03984ee..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/widgetList.h +++ /dev/null @@ -1,80 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_WIDGET_LIST -#define FFW_UI_WIDGET_LIST - -#include "widget.h" - -/*! - @ingroup User-Interface -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup User-Interface - @inherit uiWidget - @sa uiWidget - */ - class FFW_API uiWidgetList : public uiWidget { - public: - /*! - @memberof uiWidgetList - @ingroup User-Interface - */ - uiWidgetList(const std::string& ID, float PosX, float PosY, float Width, float Height, int ItemHeight, int StrLength, const std::vector& Items); - ~uiWidgetList(); - - void update() override; - void hover(bool Hover) override; - void mousePressed(int Button, int PosX, int PosY) override; - void mouseReleased(int Button) override; - void mousePos(int PosX, int PosY) override; - - /*! - @memberof uiWidgetList - @ingroup User-Interface - */ - void setValue(const std::vector& Items); - /*! - @memberof uiWidgetList - @ingroup User-Interface - */ - int getSelected(); - /*! - @memberof uiWidgetList - @ingroup User-Interface - */ - const std::wstring& getSelectedStr(); - - private: - void updateScroller(); - void updateList(); - - float* knobNormal; - float* knobHover; - float* knobActive; - float value; - int mouseX; - int mouseY; - bool drag; - int selected; - int start; - int startOld; - int selectedOld; - int itemHeight; - int itemCount; - int strLength; - ffw::vec2f selectionSize; - std::vector items; - }; -}; - -#endif - - - - diff --git a/third-party-libs/FragmentFramework/include/userInterface/widgetProgressbar.h b/third-party-libs/FragmentFramework/include/userInterface/widgetProgressbar.h deleted file mode 100644 index cfed886..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/widgetProgressbar.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_WIDGET_PROGRESSBAR -#define FFW_UI_WIDGET_PROGRESSBAR - -#include "widget.h" - -/*! - @ingroup User-Interface -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup User-Interface - @inherit uiWidget - @sa uiWidget - */ - class FFW_API uiWidgetProgressbar : public uiWidget { - public: - /*! - @memberof uiWidgetProgressbar - @ingroup User-Interface - */ - uiWidgetProgressbar(const std::string& ID, float PosX, float PosY, float Width, float Value); - ~uiWidgetProgressbar(); - - void update() override; - /*! - @memberof uiWidgetProgressbar - @ingroup User-Interface - */ - void setValue(float Value); - /*! - @memberof uiWidgetProgressbar - @ingroup User-Interface - */ - float getValue() const; - - private: - void updateProgress(); - float value; - }; -}; - -#endif - - - - - - - diff --git a/third-party-libs/FragmentFramework/include/userInterface/widgetScroller.h b/third-party-libs/FragmentFramework/include/userInterface/widgetScroller.h deleted file mode 100644 index c8f4406..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/widgetScroller.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_WIDGET_SCROLLER -#define FFW_UI_WIDGET_SCROLLER - -#include "widget.h" - -/*! - @ingroup User-Interface -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup User-Interface - @inherit uiWidget - @sa uiWidget - */ - class FFW_API uiWidgetScroller : public uiWidget { - public: - /*! - @memberof uiWidgetScroller - @ingroup User-Interface - */ - uiWidgetScroller(const std::string& ID, float PosX, float PosY, float Width, float Value, bool Vertical); - ~uiWidgetScroller(); - - void update() override; - void hover(bool Hover) override; - void mousePressed(int Button, int PosX, int PosY) override; - void mouseReleased(int Button) override; - void mousePos(int PosX, int PosY) override; - /*! - @memberof uiWidgetScroller - @ingroup User-Interface - */ - void setValue(float Value); - /*! - @memberof uiWidgetScroller - @ingroup User-Interface - */ - float getValue() const; - - private: - void updateScroller(); - - float* knobNormal; - float* knobHover; - float* knobActive; - float value; - int mouseX; - int mouseY; - bool vertical; - bool drag; - }; -}; - -#endif - diff --git a/third-party-libs/FragmentFramework/include/userInterface/widgetSlider.h b/third-party-libs/FragmentFramework/include/userInterface/widgetSlider.h deleted file mode 100644 index f03c8ff..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/widgetSlider.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_WIDGET_SLIDER -#define FFW_UI_WIDGET_SLIDER - -#include "widget.h" - -/*! - @ingroup User-Interface -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup User-Interface - @inherit uiWidget - @sa uiWidget - */ - class FFW_API uiWidgetSlider : public uiWidget { - public: - /*! - @memberof uiWidgetSlider - @ingroup User-Interface - */ - uiWidgetSlider(const std::string& ID, float PosX, float PosY, float Width, float Value, bool Vertical); - ~uiWidgetSlider(); - - void update() override; - void hover(bool Hover) override; - void mousePressed(int Button, int PosX, int PosY) override; - void mouseReleased(int Button) override; - void mousePos(int PosX, int PosY) override; - /*! - @memberof uiWidgetSlider - @ingroup User-Interface - */ - void setValue(float Value); - /*! - @memberof uiWidgetSlider - @ingroup User-Interface - */ - float getValue() const; - - private: - void updateSlider(); - - float* knobNormal; - float* knobHover; - float* knobActive; - float value; - int mouseX; - int mouseY; - bool vertical; - bool drag; - }; -}; - -#endif diff --git a/third-party-libs/FragmentFramework/include/userInterface/widgetSwitch.h b/third-party-libs/FragmentFramework/include/userInterface/widgetSwitch.h deleted file mode 100644 index b5d2fb5..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/widgetSwitch.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_WIDGET_SWITCH -#define FFW_UI_WIDGET_SWITCH - -#include "widget.h" - -/*! - @ingroup User-Interface -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup User-Interface - @inherit uiWidget - @sa uiWidget - */ - class FFW_API uiWidgetSwitch : public uiWidget { - public: - /*! - @memberof uiWidgetSwitch - @ingroup User-Interface - */ - uiWidgetSwitch(const std::string& ID, float PosX, float PosY, bool Vertical, bool Value); - ~uiWidgetSwitch(); - - void update() override; - void mousePressed(int Button, int PosX, int PosY) override; - /*! - @memberof uiWidgetSwitch - @ingroup User-Interface - */ - void setValue(bool Value); - /*! - @memberof uiWidgetSwitch - @ingroup User-Interface - */ - bool getValue() const; - - private: - float* bufferOn; - float* bufferOff; - bool value; - bool vertical; - }; -}; - -#endif - - - - - - diff --git a/third-party-libs/FragmentFramework/include/userInterface/widgetTextInput.h b/third-party-libs/FragmentFramework/include/userInterface/widgetTextInput.h deleted file mode 100644 index 88489ca..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/widgetTextInput.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_WIDGET_TEXT_INPUT -#define FFW_UI_WIDGET_TEXT_INPUT - -#include "widget.h" - -/*! - @ingroup User-Interface -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup User-Interface - @inherit uiWidget - @sa uiWidget - */ - class FFW_API uiWidgetTextInput : public uiWidget { - public: - /*! - @memberof uiWidgetTextInput - @ingroup User-Interface - */ - uiWidgetTextInput(const std::string& ID, float PosX, float PosY, float Width, const std::wstring& Text, int Length = 100); - ~uiWidgetTextInput(); - - void update() override; - void focus(bool Focus) override; - void keyPressed(int Key, int Mode) override; - void textInput(int C) override; - /*! - @memberof uiWidgetTextInput - @ingroup User-Interface - */ - void setValue(const std::string& Str); - /*! - @memberof uiWidgetTextInput - @ingroup User-Interface - */ - void setValue(const std::wstring& Str); - /*! - @memberof uiWidgetTextInput - @ingroup User-Interface - */ - const std::wstring& getValue() const; - - private: - void updateTextNormal(); - void updateTextFocus(); - - float* bufferNormal; - float* bufferFocus; - std::wstring text; - int maxLength; - ffw::vec2f stringPos; - - int dotsWidth; - int underscoreWidth; - bool textHasChanged; - bool ctrlPressed; - }; -}; - -#endif - - - - - diff --git a/third-party-libs/FragmentFramework/include/userInterface/window.h b/third-party-libs/FragmentFramework/include/userInterface/window.h deleted file mode 100644 index b69bf83..0000000 --- a/third-party-libs/FragmentFramework/include/userInterface/window.h +++ /dev/null @@ -1,166 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_UI_WINDOW -#define FFW_UI_WINDOW - -#include "../dll.h" -#include "canvas.h" -#include "widgetImage.h" -#include "callback.h" - -#include "../math/stringMath.h" -#include "../math/math.h" -#include "sharedData.h" - -/*! - @ingroup User-Interface -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup User-Interface - */ - class FFW_API uiWindow { - public: - uiWindow(bool Tilebar, bool Closeable, bool Background); - ~uiWindow(); - - struct canvasWrapper { - uiCanvas* ptr; - bool hasHover; - }; - - bool init(); - void create(); - void destroy(); - void updateBuffers(); - /*! - @memberof uiWindow - @ingroup User-Interface - */ - void setTitle(const std::wstring& Title); - /*! - @memberof uiWindow - @ingroup User-Interface - */ - uiCanvas* addCanvas(int PosX, int PosY, int Width, int Height); - /*! - @memberof uiWindow - @ingroup User-Interface - */ - const std::vector& getCanvases(); - /*! - @memberof uiWindow - @ingroup User-Interface - */ - uiCanvas* getBackgroundCanvas(); - /*! - @memberof uiWindow - @ingroup User-Interface - */ - void injectMousePos(int MouseX, int MouseY); - /*! - @memberof uiWindow - @ingroup User-Interface - */ - void injectMouseButtonPressed(int Button); - /*! - @memberof uiWindow - @ingroup User-Interface - */ - void injectMouseButtonReleased(int Button); - /*! - @memberof uiWindow - @ingroup User-Interface - */ - void injectKeyPressed(int Key, int Mode); - /*! - @memberof uiWindow - @ingroup User-Interface - */ - void injectTextInput(int C); - /*! - @memberof uiWindow - @ingroup User-Interface - */ - void resetUserInput(); - /*! - @memberof uiWindow - @ingroup User-Interface - */ - void setSize(int Width, int Height); - /*! - @memberof uiWindow - @ingroup User-Interface - */ - void setPos(int PosX, int PosY); - /*! - @memberof uiWindow - @ingroup User-Interface - */ - const ffw::vec2i& getSize() const; - /*! - @memberof uiWindow - @ingroup User-Interface - */ - const ffw::vec2i& getPos() const; - /*! - @memberof uiWindow - @ingroup User-Interface - */ - void setMoveable(bool Moveable); - /*! - @memberof uiWindow - @ingroup User-Interface - */ - bool isMoveable() const; - /*! - @memberof uiWindow - @ingroup User-Interface - */ - void setVisible(bool Visibility); - /*! - @memberof uiWindow - @ingroup User-Interface - */ - bool isVisible() const; - void setDataPtr(uiSharedData* SharedData); - void poolEvents(); - void poolEventsPrivate(); - /*! - @memberof uiWindow - @ingroup User-Interface - */ - template void addListener(void (T::*Func)(const uiEvent&), T* Instance){ - callback* clb = new callback(Func, Instance); - listeners.push_back(clb); - } - - private: - void windowBackgroundEvent(const uiEvent& Event); - uiWidget* addWidgetBcg(uiWidget* Widget); - - std::vector canvases; - std::vector listeners; - std::vector listenersPrivate; - uiCanvas backgroundCanvas; - uiSharedData* sharedData; - std::wstring title; - ffw::vec2i size; - ffw::vec2i pos; - bool visible; - bool moveable; - bool tilebar; - bool hideable; - bool createBackground; - bool createTilebar; - bool createCloseButton; - uiWidget* buttonClose; - }; -}; - -#endif diff --git a/third-party-libs/FragmentFramework/include/utilities/file.cpp b/third-party-libs/FragmentFramework/include/utilities/file.cpp deleted file mode 100644 index f26b56b..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/file.cpp +++ /dev/null @@ -1,194 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#include "file.h" -#include "../math/math.h" -#include "../math/stringMath.h" -#include -#include -#include - -///============================================================================= -ffw::file::file(){ -} - -///============================================================================= -ffw::file::~file(){ - if(fileStream.is_open())fileStream.close(); -} - -///============================================================================= -bool ffw::file::open(const std::string& Path, bool IsBinary, bool Write, bool DeleteContents){ - return open(utf8ToWstr(Path), IsBinary, Write, DeleteContents); -} - -///============================================================================= -bool ffw::file::open(const std::wstring& Path, bool IsBinary, bool Write, bool DeleteContents){ - std::ios_base::openmode mode; - // Ugly mode selection - if(IsBinary){ - if(Write){ - if(DeleteContents) mode = std::ios::out | std::ios::binary | std::ios::trunc; - else mode = std::ios::out | std::ios::binary; - } else { - if(DeleteContents) mode = std::ios::in | std::ios::binary | std::ios::trunc; - else mode = std::ios::in | std::ios::binary; - } - } else { - if(Write){ - if(DeleteContents) mode = std::ios::out | std::ios::trunc; - else mode = std::ios::out; - } else { - if(DeleteContents) mode = std::ios::in | std::ios::trunc; - else mode = std::ios::in; - } - } - fileStream.open(wstrToAnsi(Path), mode); - - if(!fileStream){ - return false; - } - - //if(!Write)gotoBeginning(); - - return true; -} - -///============================================================================= -bool ffw::file::isOpen(){ - return fileStream.is_open(); - //return fileOpen; -} - -///============================================================================= -bool ffw::file::read(void* Data, size_t Size){ - if(!fileStream.is_open())return false; - fileStream.read(reinterpret_cast(Data), Size); - //return !fileStream.fail(); - return true; -} - -///============================================================================= -bool ffw::file::write(void* Data, size_t Size){ - if(!fileStream.is_open())return false; - fileStream.write(reinterpret_cast(Data), Size); - return !fileStream.fail(); -} - -///============================================================================= -bool ffw::file::readLine(std::string* Str){ - if(!fileStream.is_open())return false; - std::getline(fileStream, *Str); - //return !fileStream.fail(); - return true; -} - -///============================================================================= -bool ffw::file::writeLine(const std::string& Str){ - if(!fileStream.is_open())return false; - if(!(fileStream << Str))return false; - fileStream.put('\n'); - return !fileStream.fail(); -} - -///============================================================================= -bool ffw::file::readChar(char* Chr){ - if(!fileStream.is_open())return false; - fileStream.get(*Chr); - //return !fileStream.fail(); - return true; -} - -///============================================================================= -bool ffw::file::writeChar(char Chr){ - if(!fileStream.is_open())return false; - fileStream.put(Chr); - return !fileStream.fail(); -} - -///============================================================================= -bool ffw::file::gotoPos(unsigned int Pos){ - if(!fileStream.is_open())return false; - fileStream.seekg(Pos); - return !fileStream.fail(); -} - -///============================================================================= -bool ffw::file::gotoPosOffset(unsigned int Pos){ - if(!fileStream.is_open())return false; - std::streampos currentPos = fileStream.tellg(); - currentPos += Pos; - fileStream.seekg(currentPos); - return !fileStream.fail(); -} - -///============================================================================= -bool ffw::file::gotoLine(unsigned int Num){ - if(!fileStream.is_open())return false; - if(!gotoBeginning())return false; - - unsigned int i = 0; - while(i != Num){ - fileStream.ignore(256, '\n'); - if(fileStream.fail())return false; - i++; - } - std::streampos pos = fileStream.tellg(); - pos -= 1; - fileStream.seekg(pos); - return true; -} - -///============================================================================= -bool ffw::file::gotoEnd(){ - if(!fileStream.is_open())return false; - fileStream.seekg(0, std::ios::end); - return true; -} - -///============================================================================= -bool ffw::file::gotoBeginning(){ - if(!fileStream.is_open())return false; - fileStream.seekg(0, std::ios::beg); - return true; -} - -///============================================================================= -size_t ffw::file::getPos(){ - if(!fileStream.is_open())return 0; - return (size_t)fileStream.tellg(); -} - -///============================================================================= -size_t ffw::file::countLines(){ - if(!fileStream.is_open())return 0; - size_t pos = (size_t)fileStream.tellg(); - fileStream.seekg(0, std::ios::beg); - size_t lines = (size_t)std::count(std::istreambuf_iterator(fileStream), std::istreambuf_iterator(), '\n'); - fileStream.seekg(pos); - if(getSize() > 0 && lines == 0)lines = 1; - return lines; -} - -///============================================================================= -void ffw::file::close(){ - fileStream.close(); -} - -///============================================================================= -size_t ffw::file::getSize(){ - if(!fileStream.is_open())return 0; - size_t pos = (size_t)fileStream.tellg(); - fileStream.seekg(0, std::ios::end); - size_t size = (size_t)fileStream.tellg(); - fileStream.seekg(pos); - return size; -} - -///============================================================================= -bool ffw::file::eof(){ - return fileStream.eof(); -} diff --git a/third-party-libs/FragmentFramework/include/utilities/fileUtilities.cpp b/third-party-libs/FragmentFramework/include/utilities/fileUtilities.cpp deleted file mode 100644 index 211083c..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/fileUtilities.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#include "fileUtilities.h" - -///============================================================================= -bool ffw::checkIfFileExists(const std::wstring& Path){ - FILE* file = _wfopen(Path.c_str(), L"r"); - if(file == NULL)return false; - fclose(file); - return true; -} - -///============================================================================= -bool ffw::checkIfFileExists(const std::string& Path){ - FILE* file = fopen(Path.c_str(), "r"); - if(file == NULL)return false; - fclose(file); - return true; -} - -///============================================================================= -void ffw::getFilePathProperties(const std::string& Path, std::string *Directory, std::string *FileName, std::string *FileExtension){ - size_t slashPos = Path.find_last_of('\\'); - size_t dotPos = Path.find_last_of('.'); - size_t namePos = 0; - - if(slashPos == std::string::npos)slashPos = Path.find_last_of('/'); - - if(slashPos != std::string::npos){ - namePos = slashPos+1; - if(Directory != NULL)*Directory = Path.substr(0, slashPos+1); - } else { - if(Directory != NULL)*Directory = ""; - } - - dotPos = Path.find_last_of('.'); - - if(dotPos != std::string::npos){ - if(FileName != NULL)*FileName = Path.substr(namePos, dotPos-namePos); - if(FileExtension != NULL)*FileExtension = Path.substr(dotPos+1, Path.size()-dotPos-1); - } else { - if(FileName != NULL)*FileName = Path.substr(namePos, Path.size()-namePos); - if(FileExtension != NULL)*FileExtension = ""; - } -} diff --git a/third-party-libs/FragmentFramework/include/utilities/loadSaveBmp.cpp b/third-party-libs/FragmentFramework/include/utilities/loadSaveBmp.cpp deleted file mode 100644 index eb94e51..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/loadSaveBmp.cpp +++ /dev/null @@ -1,349 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#include "loadSaveBmp.h" -#include "../math/math.h" -#include "../math/stringMath.h" -#include "file.h" - -static uint8_t bmpBitmap1Header[] = {0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00}; -static uint8_t bmpGrayscale4Header[] = {0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x00, 0x22, 0x22, 0x22, 0x00, 0x33, 0x33, 0x33, 0x00, 0x44, 0x44, 0x44, 0x00, 0x55, 0x55, 0x55, 0x00, 0x66, 0x66, 0x66, 0x00, 0x77, 0x77, 0x77, 0x00, 0x88, 0x88, 0x88, 0x00, 0x99, 0x99, 0x99, 0x00, 0xAA, 0xAA, 0xAA, 0x00, 0xBB, 0xBB, 0xBB, 0x00, 0xCC, 0xCC, 0xCC, 0x00, 0xDD, 0xDD, 0xDD, 0x00, 0xEE, 0xEE, 0xEE, 0x00, 0xFF, 0xFF, 0xFF, 0x00}; -static uint8_t bmpGrayscale8Header[] = {0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x02, 0x02, 0x02, 0x00, 0x03, 0x03, 0x03, 0x00, 0x04, 0x04, 0x04, 0x00, 0x05, 0x05, 0x05, 0x00, 0x06, 0x06, 0x06, 0x00, 0x07, 0x07, 0x07, 0x00, 0x08, 0x08, 0x08, 0x00, 0x09, 0x09, 0x09, 0x00, 0x0A, 0x0A, 0x0A, 0x00, 0x0B, 0x0B, 0x0B, 0x00, 0x0C, 0x0C, 0x0C, 0x00, 0x0D, 0x0D, 0x0D, 0x00, 0x0E, 0x0E, 0x0E, 0x00, 0x0F, 0x0F, 0x0F, 0x00, 0x10, 0x10, 0x10, 0x00, 0x11, 0x11, 0x11, 0x00, 0x12, 0x12, 0x12, 0x00, 0x13, 0x13, 0x13, 0x00, 0x14, 0x14, 0x14, 0x00, 0x15, 0x15, 0x15, 0x00, 0x16, 0x16, 0x16, 0x00, 0x17, 0x17, 0x17, 0x00, 0x18, 0x18, 0x18, 0x00, 0x19, 0x19, 0x19, 0x00, 0x1A, 0x1A, 0x1A, 0x00, 0x1B, 0x1B, 0x1B, 0x00, 0x1C, 0x1C, 0x1C, 0x00, 0x1D, 0x1D, 0x1D, 0x00, 0x1E, 0x1E, 0x1E, 0x00, 0x1F, 0x1F, 0x1F, 0x00, 0x20, 0x20, 0x20, 0x00, 0x21, 0x21, 0x21, 0x00, 0x22, 0x22, 0x22, 0x00, 0x23, 0x23, 0x23, 0x00, 0x24, 0x24, 0x24, 0x00, 0x25, 0x25, 0x25, 0x00, 0x26, 0x26, 0x26, 0x00, 0x27, 0x27, 0x27, 0x00, 0x28, 0x28, 0x28, 0x00, 0x29, 0x29, 0x29, 0x00, 0x2A, 0x2A, 0x2A, 0x00, 0x2B, 0x2B, 0x2B, 0x00, 0x2C, 0x2C, 0x2C, 0x00, 0x2D, 0x2D, 0x2D, 0x00, 0x2E, 0x2E, 0x2E, 0x00, 0x2F, 0x2F, 0x2F, 0x00, 0x30, 0x30, 0x30, 0x00, 0x31, 0x31, 0x31, 0x00, 0x32, 0x32, 0x32, 0x00, 0x33, 0x33, 0x33, 0x00, 0x34, 0x34, 0x34, 0x00, 0x35, 0x35, 0x35, 0x00, 0x36, 0x36, 0x36, 0x00, 0x37, 0x37, 0x37, 0x00, 0x38, 0x38, 0x38, 0x00, 0x39, 0x39, 0x39, 0x00, 0x3A, 0x3A, 0x3A, 0x00, 0x3B, 0x3B, 0x3B, 0x00, 0x3C, 0x3C, 0x3C, 0x00, 0x3D, 0x3D, 0x3D, 0x00, 0x3E, 0x3E, 0x3E, 0x00, 0x3F, 0x3F, 0x3F, 0x00, 0x40, 0x40, 0x40, 0x00, 0x41, 0x41, 0x41, 0x00, 0x42, 0x42, 0x42, 0x00, 0x43, 0x43, 0x43, 0x00, 0x44, 0x44, 0x44, 0x00, 0x45, 0x45, 0x45, 0x00, 0x46, 0x46, 0x46, 0x00, 0x47, 0x47, 0x47, 0x00, 0x48, 0x48, 0x48, 0x00, 0x49, 0x49, 0x49, 0x00, 0x4A, 0x4A, 0x4A, 0x00, 0x4B, 0x4B, 0x4B, 0x00, 0x4C, 0x4C, 0x4C, 0x00, 0x4D, 0x4D, 0x4D, 0x00, 0x4E, 0x4E, 0x4E, 0x00, 0x4F, 0x4F, 0x4F, 0x00, 0x50, 0x50, 0x50, 0x00, 0x51, 0x51, 0x51, 0x00, 0x52, 0x52, 0x52, 0x00, 0x53, 0x53, 0x53, 0x00, 0x54, 0x54, 0x54, 0x00, 0x55, 0x55, 0x55, 0x00, 0x56, 0x56, 0x56, 0x00, 0x57, 0x57, 0x57, 0x00, 0x58, 0x58, 0x58, 0x00, 0x59, 0x59, 0x59, 0x00, 0x5A, 0x5A, 0x5A, 0x00, 0x5B, 0x5B, 0x5B, 0x00, 0x5C, 0x5C, 0x5C, 0x00, 0x5D, 0x5D, 0x5D, 0x00, 0x5E, 0x5E, 0x5E, 0x00, 0x5F, 0x5F, 0x5F, 0x00, 0x60, 0x60, 0x60, 0x00, 0x61, 0x61, 0x61, 0x00, 0x62, 0x62, 0x62, 0x00, 0x63, 0x63, 0x63, 0x00, 0x64, 0x64, 0x64, 0x00, 0x65, 0x65, 0x65, 0x00, 0x66, 0x66, 0x66, 0x00, 0x67, 0x67, 0x67, 0x00, 0x68, 0x68, 0x68, 0x00, 0x69, 0x69, 0x69, 0x00, 0x6A, 0x6A, 0x6A, 0x00, 0x6B, 0x6B, 0x6B, 0x00, 0x6C, 0x6C, 0x6C, 0x00, 0x6D, 0x6D, 0x6D, 0x00, 0x6E, 0x6E, 0x6E, 0x00, 0x6F, 0x6F, 0x6F, 0x00, 0x70, 0x70, 0x70, 0x00, 0x71, 0x71, 0x71, 0x00, 0x72, 0x72, 0x72, 0x00, 0x73, 0x73, 0x73, 0x00, 0x74, 0x74, 0x74, 0x00, 0x75, 0x75, 0x75, 0x00, 0x76, 0x76, 0x76, 0x00, 0x77, 0x77, 0x77, 0x00, 0x78, 0x78, 0x78, 0x00, 0x79, 0x79, 0x79, 0x00, 0x7A, 0x7A, 0x7A, 0x00, 0x7B, 0x7B, 0x7B, 0x00, 0x7C, 0x7C, 0x7C, 0x00, 0x7D, 0x7D, 0x7D, 0x00, 0x7E, 0x7E, 0x7E, 0x00, 0x7F, 0x7F, 0x7F, 0x00, 0x80, 0x80, 0x80, 0x00, 0x81, 0x81, 0x81, 0x00, 0x82, 0x82, 0x82, 0x00, 0x83, 0x83, 0x83, 0x00, 0x84, 0x84, 0x84, 0x00, 0x85, 0x85, 0x85, 0x00, 0x86, 0x86, 0x86, 0x00, 0x87, 0x87, 0x87, 0x00, 0x88, 0x88, 0x88, 0x00, 0x89, 0x89, 0x89, 0x00, 0x8A, 0x8A, 0x8A, 0x00, 0x8B, 0x8B, 0x8B, 0x00, 0x8C, 0x8C, 0x8C, 0x00, 0x8D, 0x8D, 0x8D, 0x00, 0x8E, 0x8E, 0x8E, 0x00, 0x8F, 0x8F, 0x8F, 0x00, 0x90, 0x90, 0x90, 0x00, 0x91, 0x91, 0x91, 0x00, 0x92, 0x92, 0x92, 0x00, 0x93, 0x93, 0x93, 0x00, 0x94, 0x94, 0x94, 0x00, 0x95, 0x95, 0x95, 0x00, 0x96, 0x96, 0x96, 0x00, 0x97, 0x97, 0x97, 0x00, 0x98, 0x98, 0x98, 0x00, 0x99, 0x99, 0x99, 0x00, 0x9A, 0x9A, 0x9A, 0x00, 0x9B, 0x9B, 0x9B, 0x00, 0x9C, 0x9C, 0x9C, 0x00, 0x9D, 0x9D, 0x9D, 0x00, 0x9E, 0x9E, 0x9E, 0x00, 0x9F, 0x9F, 0x9F, 0x00, 0xA0, 0xA0, 0xA0, 0x00, 0xA1, 0xA1, 0xA1, 0x00, 0xA2, 0xA2, 0xA2, 0x00, 0xA3, 0xA3, 0xA3, 0x00, 0xA4, 0xA4, 0xA4, 0x00, 0xA5, 0xA5, 0xA5, 0x00, 0xA6, 0xA6, 0xA6, 0x00, 0xA7, 0xA7, 0xA7, 0x00, 0xA8, 0xA8, 0xA8, 0x00, 0xA9, 0xA9, 0xA9, 0x00, 0xAA, 0xAA, 0xAA, 0x00, 0xAB, 0xAB, 0xAB, 0x00, 0xAC, 0xAC, 0xAC, 0x00, 0xAD, 0xAD, 0xAD, 0x00, 0xAE, 0xAE, 0xAE, 0x00, 0xAF, 0xAF, 0xAF, 0x00, 0xB0, 0xB0, 0xB0, 0x00, 0xB1, 0xB1, 0xB1, 0x00, 0xB2, 0xB2, 0xB2, 0x00, 0xB3, 0xB3, 0xB3, 0x00, 0xB4, 0xB4, 0xB4, 0x00, 0xB5, 0xB5, 0xB5, 0x00, 0xB6, 0xB6, 0xB6, 0x00, 0xB7, 0xB7, 0xB7, 0x00, 0xB8, 0xB8, 0xB8, 0x00, 0xB9, 0xB9, 0xB9, 0x00, 0xBA, 0xBA, 0xBA, 0x00, 0xBB, 0xBB, 0xBB, 0x00, 0xBC, 0xBC, 0xBC, 0x00, 0xBD, 0xBD, 0xBD, 0x00, 0xBE, 0xBE, 0xBE, 0x00, 0xBF, 0xBF, 0xBF, 0x00, 0xC0, 0xC0, 0xC0, 0x00, 0xC1, 0xC1, 0xC1, 0x00, 0xC2, 0xC2, 0xC2, 0x00, 0xC3, 0xC3, 0xC3, 0x00, 0xC4, 0xC4, 0xC4, 0x00, 0xC5, 0xC5, 0xC5, 0x00, 0xC6, 0xC6, 0xC6, 0x00, 0xC7, 0xC7, 0xC7, 0x00, 0xC8, 0xC8, 0xC8, 0x00, 0xC9, 0xC9, 0xC9, 0x00, 0xCA, 0xCA, 0xCA, 0x00, 0xCB, 0xCB, 0xCB, 0x00, 0xCC, 0xCC, 0xCC, 0x00, 0xCD, 0xCD, 0xCD, 0x00, 0xCE, 0xCE, 0xCE, 0x00, 0xCF, 0xCF, 0xCF, 0x00, 0xD0, 0xD0, 0xD0, 0x00, 0xD1, 0xD1, 0xD1, 0x00, 0xD2, 0xD2, 0xD2, 0x00, 0xD3, 0xD3, 0xD3, 0x00, 0xD4, 0xD4, 0xD4, 0x00, 0xD5, 0xD5, 0xD5, 0x00, 0xD6, 0xD6, 0xD6, 0x00, 0xD7, 0xD7, 0xD7, 0x00, 0xD8, 0xD8, 0xD8, 0x00, 0xD9, 0xD9, 0xD9, 0x00, 0xDA, 0xDA, 0xDA, 0x00, 0xDB, 0xDB, 0xDB, 0x00, 0xDC, 0xDC, 0xDC, 0x00, 0xDD, 0xDD, 0xDD, 0x00, 0xDE, 0xDE, 0xDE, 0x00, 0xDF, 0xDF, 0xDF, 0x00, 0xE0, 0xE0, 0xE0, 0x00, 0xE1, 0xE1, 0xE1, 0x00, 0xE2, 0xE2, 0xE2, 0x00, 0xE3, 0xE3, 0xE3, 0x00, 0xE4, 0xE4, 0xE4, 0x00, 0xE5, 0xE5, 0xE5, 0x00, 0xE6, 0xE6, 0xE6, 0x00, 0xE7, 0xE7, 0xE7, 0x00, 0xE8, 0xE8, 0xE8, 0x00, 0xE9, 0xE9, 0xE9, 0x00, 0xEA, 0xEA, 0xEA, 0x00, 0xEB, 0xEB, 0xEB, 0x00, 0xEC, 0xEC, 0xEC, 0x00, 0xED, 0xED, 0xED, 0x00, 0xEE, 0xEE, 0xEE, 0x00, 0xEF, 0xEF, 0xEF, 0x00, 0xF0, 0xF0, 0xF0, 0x00, 0xF1, 0xF1, 0xF1, 0x00, 0xF2, 0xF2, 0xF2, 0x00, 0xF3, 0xF3, 0xF3, 0x00, 0xF4, 0xF4, 0xF4, 0x00, 0xF5, 0xF5, 0xF5, 0x00, 0xF6, 0xF6, 0xF6, 0x00, 0xF7, 0xF7, 0xF7, 0x00, 0xF8, 0xF8, 0xF8, 0x00, 0xF9, 0xF9, 0xF9, 0x00, 0xFA, 0xFA, 0xFA, 0x00, 0xFB, 0xFB, 0xFB, 0x00, 0xFC, 0xFC, 0xFC, 0x00, 0xFD, 0xFD, 0xFD, 0x00, 0xFE, 0xFE, 0xFE, 0x00, 0xFF, 0xFF, 0xFF, 0x00}; - -///============================================================================= -bool ffw::loadBMP(const std::string& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type){ - return loadBMP(utf8ToWstr(Path), Pixels, Width, Height, Type); -} - -///============================================================================= -bool ffw::loadBMP(const std::wstring& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type){ - file input; - if(!input.open(Path, true, false, false)){ - return false; - } - - // Check if file is big enough to contain header - size_t size = input.getSize(); - if(size < 54)return false; - - uint16_t fileType; - uint32_t fileSize; - uint32_t reserved; - uint32_t dataOffset; - uint32_t infoSize; - uint32_t width; - uint32_t height; - uint16_t planes; - uint16_t bitsPerPixel; - uint32_t compression; - uint32_t imageSize; - uint32_t resolutionX; - uint32_t resolutionY; - uint32_t numberOfColors; - uint32_t importantColors; - imageType type; - - input.read(&fileType, sizeof(uint16_t)); - if(fileType != 0x4D42){ - return false; - } - - input.read(&fileSize, sizeof(uint32_t)); - input.read(&reserved, sizeof(uint32_t)); - input.read(&dataOffset, sizeof(uint32_t)); - input.read(&infoSize, sizeof(uint32_t)); - input.read(&width, sizeof(uint32_t)); - input.read(&height, sizeof(uint32_t)); - input.read(&planes, sizeof(uint16_t)); - input.read(&bitsPerPixel, sizeof(uint16_t)); - input.read(&compression, sizeof(uint32_t)); - input.read(&imageSize, sizeof(uint32_t)); - input.read(&resolutionX, sizeof(uint32_t)); - input.read(&resolutionY, sizeof(uint32_t)); - input.read(&numberOfColors, sizeof(uint32_t)); - input.read(&importantColors, sizeof(uint32_t)); - - if(compression != 0)return false; - - if(planes != 1)return false; - - if(bitsPerPixel == 1){ - type = ffw::imageType::BITMAP_1; - } else if(bitsPerPixel == 4){ - type = ffw::imageType::GRAYSCALE_4; - } else if(bitsPerPixel == 8){ - type = ffw::imageType::GRAYSCALE_8; - } else if(bitsPerPixel == 24){ - type = ffw::imageType::RGB_888; - } else if(bitsPerPixel == 32){ - type = ffw::imageType::RGB_ALPHA_8888; - } else { - return false; - } - - // Check if file contains all pixels - if(size < 54 + width*height*(bitsPerPixel/8)){ - return false; - } - - if(Width != NULL)*Width = width; - if(Height != NULL)*Height = height; - if(Type != NULL)*Type = type; - - if(Pixels == NULL)return true; - - if(dataOffset > 54){ - uint8_t* additionalInfo = new uint8_t[dataOffset-54]; - input.read(additionalInfo, dataOffset-54); - delete[] additionalInfo; - } - - // BITMAP_1 - if(type == ffw::imageType::BITMAP_1){ - size_t size = 0; - if((width*height) % 8 > 0){ - size = (width*height) /8 +1; - } else { - size = (width*height) /8; - } - *Pixels = new uint8_t[size]; - input.read(*Pixels, size); - - // GRAYSCALE_4 - } else if(type == ffw::imageType::GRAYSCALE_4){ - size_t size = 0; - if((width*height) % 2 > 0){ - size = (width*height) /2 +1; - } else { - size = (width*height) /2; - } - *Pixels = new uint8_t[size]; - input.read(*Pixels, size); - - // GRAYSCALE_8 - } else if(type == ffw::imageType::GRAYSCALE_8){ - *Pixels = new uint8_t[width*height]; - input.read(*Pixels, width*height); - - // BGR_888 to RGB_888 - } else if(type == ffw::imageType::RGB_888){ - uint8_t* rowPtr = new uint8_t[width*3]; - *Pixels = new uint8_t[width*height*3]; - - for(uint32_t row = 0; row < height; row++){ - input.read(rowPtr, width*3); - for(uint32_t i = width*row*3, p = 0; i < width*(row+1)*3; i += 3, p += 3){ - (*Pixels)[i] = rowPtr[p+2]; - (*Pixels)[i+1] = rowPtr[p+1]; - (*Pixels)[i+2] = rowPtr[p]; - } - } - delete[] rowPtr; - - // BGRA_8888 to RGBA_8888 - } else if(type == ffw::imageType::RGB_ALPHA_8888){ - uint8_t* rowPtr = new uint8_t[width*4]; - *Pixels = new uint8_t[width*height*4]; - - for(uint32_t row = 0; row < height; row++){ - input.read(rowPtr, width*4); - for(uint32_t i = width*row*4, p = 0; i < width*(row+1)*4; i += 3, p += 3){ - (*Pixels)[i] = rowPtr[p+2]; - (*Pixels)[i+1] = rowPtr[p+1]; - (*Pixels)[i+2] = rowPtr[p]; - (*Pixels)[i+3] = rowPtr[p+3]; - } - } - delete[] rowPtr; - } - - return true; -} - -///============================================================================= -bool ffw::saveBMP(const std::string& Path, unsigned char* Pixels, int Width, int Height, imageType Type){ - return saveBMP(utf8ToWstr(Path), Pixels, Width, Height, Type); -} - -///============================================================================= -bool ffw::saveBMP(const std::wstring& Path, unsigned char* Pixels, int Width, int Height, imageType Type){ - if(Pixels == NULL)return false; - if(Width == 0 || Height == 0)return false; - - if(!(Type == imageType::BITMAP_1 || - Type == imageType::GRAYSCALE_4 || - Type == imageType::GRAYSCALE_8 || - Type == imageType::RGB_888 || - Type == imageType::RGB_ALPHA_8888))return false; - - file output; - if(!output.open(Path, true, true, true)){ - return false; - } - - uint16_t fileType = 0x4D42; - uint32_t fileSize; - uint32_t reserved = 0x00000000; - uint32_t dataOffset; - uint32_t infoSize = 0x00000028; - uint32_t width = Width; - uint32_t height = Height; - uint16_t planes = 0x0001; - uint16_t bitsPerPixel; - uint32_t compression = 0x00000000; - uint32_t imageSize; - uint32_t resolutionX = 0x00000B12; - uint32_t resolutionY = 0x00000B12; - uint32_t numberOfColors = 0x00000000; - uint32_t importantColors = 0x00000000; - - if(Type == ffw::imageType::BITMAP_1){ - size_t size = 0; - if((width*height) % 8 > 0){ - size = (width*height) /8 +1; - } else { - size = (width*height) /8; - } - - fileSize = 0x36 + 8 + size; - dataOffset = 0x36 + 8; - bitsPerPixel = 1; - imageSize = size; - - } else if(Type == ffw::imageType::GRAYSCALE_4){ - size_t size = 0; - if((width*height) % 2 > 0){ - size = (width*height) /2 +1; - } else { - size = (width*height) /2; - } - - fileSize = 0x36 + 64 + size; - dataOffset = 0x36 + 64; - bitsPerPixel = 4; - imageSize = size; - - } else if(Type == ffw::imageType::GRAYSCALE_8){ - fileSize = 0x36 + 1024 + width*height; - dataOffset = 0x36 + 1024; - bitsPerPixel = 8; - imageSize = width*height; - - } else if(Type == ffw::imageType::RGB_888){ - fileSize = 0x36 + width*height*3; - dataOffset = 0x36; - bitsPerPixel = 24; - imageSize = width*height*3; - - } else if(Type == ffw::imageType::RGB_ALPHA_8888){ - fileSize = 0x36 + width*height*4; - dataOffset = 0x36; - bitsPerPixel = 32; - imageSize = width*height*4; - } - - output.write(&fileType, sizeof(uint16_t)); - output.write(&fileSize, sizeof(uint32_t)); - output.write(&reserved, sizeof(uint32_t)); - output.write(&dataOffset, sizeof(uint32_t)); - output.write(&infoSize, sizeof(uint32_t)); - output.write(&width, sizeof(uint32_t)); - output.write(&height, sizeof(uint32_t)); - output.write(&planes, sizeof(uint16_t)); - output.write(&bitsPerPixel, sizeof(uint16_t)); - output.write(&compression, sizeof(uint32_t)); - output.write(&imageSize, sizeof(uint32_t)); - output.write(&resolutionX, sizeof(uint32_t)); - output.write(&resolutionY, sizeof(uint32_t)); - output.write(&numberOfColors, sizeof(uint32_t)); - output.write(&importantColors, sizeof(uint32_t)); - - if(Type == ffw::imageType::BITMAP_1){ - output.write(&bmpBitmap1Header[0], sizeof(bmpBitmap1Header)); - } else if(Type == ffw::imageType::GRAYSCALE_4){ - output.write(&bmpGrayscale4Header[0], sizeof(bmpGrayscale4Header)); - } else if(Type == ffw::imageType::GRAYSCALE_8){ - output.write(&bmpGrayscale8Header[0], sizeof(bmpGrayscale8Header)); - } - - // BITMAP_1 - if(Type == ffw::imageType::BITMAP_1){ - size_t size = 0; - if((width*height) % 8 > 0){ - size = (width*height) /8 +1; - } else { - size = (width*height) /8; - } - output.write(Pixels, size); - - // GRAYSCALE_4 - } else if(Type == ffw::imageType::GRAYSCALE_4){ - size_t size = 0; - if((width*height) % 2 > 0){ - size = (width*height) /2 +1; - } else { - size = (width*height) /2; - } - output.write(Pixels, size); - - // GRAYSCALE_8 - } else if(Type == ffw::imageType::GRAYSCALE_8){ - output.write(Pixels, width*height); - - } else if(Type == ffw::imageType::RGB_888){ - /*uint8_t* temp = new uint8_t[width*height*3]; - for(uint32_t i = 0; i < width*height*3; i += 3){ - temp[i+0] = Pixels[i+2]; - temp[i+1] = Pixels[i+1]; - temp[i+2] = Pixels[i+0]; - } - output.write(temp, width*height*3); - delete[] temp;*/ - - uint8_t* rowPtr = new uint8_t[width*3]; - - for(uint32_t row = 0; row < height; row++){ - for(uint32_t i = width*row*3, p = 0; i < width*(row+1)*3; i += 3, p += 3){ - rowPtr[p+2] = Pixels[i]; - rowPtr[p+1] = Pixels[i+1]; - rowPtr[p] = Pixels[i+2]; - } - output.write(rowPtr, width*3); - } - delete[] rowPtr; - - // RGBA_8888 to BGRA_8888 - } else if(Type == ffw::imageType::RGB_ALPHA_8888){ - /*uint8_t* temp = new uint8_t[width*height*4]; - for(uint32_t i = 0; i < width*height*4; i += 4){ - temp[i+0] = Pixels[i+2]; - temp[i+1] = Pixels[i+1]; - temp[i+2] = Pixels[i+0]; - temp[i+3] = Pixels[i+3]; - } - output.write(temp, width*height*4); - delete[] temp;*/ - - uint8_t* rowPtr = new uint8_t[width*4]; - - for(uint32_t row = 0; row < height; row++){ - for(uint32_t i = width*row*4, p = 0; i < width*(row+1)*4; i += 3, p += 3){ - rowPtr[p+2] = Pixels[i]; - rowPtr[p+1] = Pixels[i+1]; - rowPtr[p] = Pixels[i+2]; - rowPtr[p+3] = Pixels[i+3]; - } - output.write(rowPtr, width*4); - } - delete[] rowPtr; - - } - - uint16_t footer = 0x0000; - output.write(&footer, sizeof(uint16_t)); - - return true; -} diff --git a/third-party-libs/FragmentFramework/include/utilities/loadSaveBmp.h b/third-party-libs/FragmentFramework/include/utilities/loadSaveBmp.h deleted file mode 100644 index 78b3597..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/loadSaveBmp.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_LOAD_SAVE_BMP -#define FFW_LOAD_SAVE_BMP - -#include "../dll.h" -#include -#include "fileUtilities.h" - -/*! - @ingroup Utilities -*/ -namespace ffw{ - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API loadBMP(const std::string& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type); - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API saveBMP(const std::string& Path, unsigned char* Pixels, int Width, int Height, imageType Type); - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API loadBMP(const std::wstring& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type); - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API saveBMP(const std::wstring& Path, unsigned char* Pixels, int Width, int Height, imageType Type); -}; -#endif diff --git a/third-party-libs/FragmentFramework/include/utilities/loadSaveJson.cpp b/third-party-libs/FragmentFramework/include/utilities/loadSaveJson.cpp deleted file mode 100644 index cd77030..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/loadSaveJson.cpp +++ /dev/null @@ -1,801 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#include "loadSaveJson.h" -#include "loadSaveTxt.h" -#include "../math/stringMath.h" -#include "../math/math.h" -#include "file.h" - -///============================================================================= -static void fixSpaces(const std::string& Str, size_t* Start, size_t* Length){ - size_t begin = *Start; - size_t end = *Start + *Length; - - for(size_t i = begin; i < end; i++){ - if(Str[i] == ' ' || Str[i] == 10 || Str[i] == 13 || Str[i] == 9)continue; - *Start = i; - *Length = end - i; - break; - } - - begin = *Start; - end = *Start + *Length; - - for(size_t i = end-1; i >= begin; i--){ - if(Str[i] == ' ' || Str[i] == 10 || Str[i] == 13 || Str[i] == 9)continue; - *Length = i - *Start +1; - break; - } -} - -///============================================================================= -static size_t findCollon(const std::string& Str, size_t Start, size_t End){ - bool insideString = false; - for(size_t i = Start; i < End; i++){ - - if(Str[i] == '\"'){ - if( ((i == Start) || (i == Start+1 && Str[i-1] != '\\')) || - ((i > Start+1) && ((Str[i-1] == '\\' && Str[i-2] == '\\') || (Str[i-1] != '\\'))) ){ - if(!insideString)insideString = true; - else if(insideString)insideString = false; - } - } - - if(!insideString && Str[i] == ':'){ - return i; - } - } - return 0; -} - -///============================================================================= -static std::string unicodeToUtf8(const std::string& Str, size_t Start){ - uint16_t value = 0; - for(int i = 0; i < 4; i++){ - if(Str[Start+i] >= 'A' && Str[Start+i] <= 'F')value += (Str[Start+i] - 'A' + 10) * (uint16_t)pow(16, 3-i); - else if(Str[Start+i] >= 'a' && Str[Start+i] <= 'f')value += (Str[Start+i] - 'a' + 10 )* (uint16_t)pow(16, 3-i); - else if(Str[Start+i] >= '0' && Str[Start+i] <= '9')value += (Str[Start+i] - '0') * (uint16_t)pow(16, 3-i); - else value += (uint16_t)pow(16, 3-i); - } - std::wstring wstr = L" "; - wstr[0] = value; - return ffw::wstrToUtf8(wstr); -} - -///============================================================================= -static std::string toUnicode(uint16_t Chr){ - std::string out = "xxxx"; - char a = Chr / 4096; - char b = (Chr -(a*4096)) / 256; - char c = (Chr -(a*4096) -(b*256)) / 16; - char d = Chr -(a*4096) -(b*256) -(c*16); - if(a >= 10) a = 'A'+(a-10); - else a = '0' + a; - if(b >= 10) b = 'A'+(b-10); - else b = '0' + b; - if(c >= 10) c = 'A'+(c-10); - else c = '0' + c; - if(d >= 10) d = 'A'+(d-10); - else d = '0' + d; - out[0] = a; - out[1] = b; - out[2] = c; - out[3] = d; - return out; -} - -///============================================================================= -static std::string escapeString(std::string Str, bool EscapeUnicode){ - if(Str.size() == 0)return ""; - for(size_t i = 0; ; i++){ - if((unsigned char)Str[i] < 32){ - if(Str[i] == 8){ - Str.replace(i, 1, "\\b"); - i++; - //continue; - } else if(Str[i] == 9){ - Str.replace(i, 1, "\\t"); - i++; - //continue; - } else if(Str[i] == 10){ - Str.replace(i, 1, "\\n"); - i++; - //continue; - } else if(Str[i] == 12){ - Str.replace(i, 1, "\\f"); - i++; - //continue; - } else if(Str[i] == 13){ - Str.replace(i, 1, "\\c"); - i++; - //continue; - } else { - Str.replace(i, 1, "\\u" + toUnicode((unsigned char)(Str[i]))); - i += 5; - //std::cout << "i: " << i << std::endl; - //continue; - } - } else if(uint16_t((uint8_t)Str[i]) > 127 && EscapeUnicode){ - size_t p = 0; - while(uint16_t((uint8_t)Str[i+p]) > 127 && i+p < Str.size()){ - p++; - } - - std::wstring mbstr = ffw::utf8ToWstr(Str.substr(i, p)); - //std::cout << "replacing: " << mstr[0] << std::endl; - std::string unicodeStr; - for(const auto& chr : mbstr){ - unicodeStr += "\\u" + toUnicode((uint16_t)chr); - } - Str.replace(i, p, unicodeStr); - i+= unicodeStr.size(); - //continue; - - } else if(Str[i] == '\"'){ - Str.replace(i, 1, "\\\""); - i++; - //continue; - } else if(Str[i] == '\\'){ - Str.replace(i, 1, "\\\\"); - i++; - //continue; - } else if(Str[i] == '/'){ - Str.replace(i, 1, "\\/"); - i++; - //continue; - } - //i++; - if(i >= Str.size()-1)break; - } - return Str; -} - -///============================================================================= -static std::string parseStringSimple(const std::string& Str){ - std::string out = Str; - - for(size_t i = 0; ; i++){ - if(out[i] == '\\' && i < out.size()-1){ - if(out[i+1] == '\"'){ - out.replace(i, 2, "\""); - - } else if(out[i+1] == '/'){ - out.replace(i, 2, "/"); - - } else if(out[i+1] == '\\'){ - out.replace(i, 2, "\\"); - - } else if(out[i+1] == 'b'){ - out.replace(i, 2, " "); - out[i] = 8; - - } else if(out[i+1] == 'f'){ - out.replace(i, 2, " "); - out[i] = 12; - - } else if(out[i+1] == 'n'){ - out.replace(i, 2, " "); - out[i] = 10; - - } else if(out[i+1] == 'r'){ - out.replace(i, 2, " "); - out[i] = 13; - - } else if(out[i+1] == 'u' && i < out.size()-5){ - out.replace(i, 5, unicodeToUtf8(out, i+2)); - i++; - } - } - if(i >= out.size()-1)break; - } - - return out; -} - -///============================================================================= -static bool parseString(const std::string& Str, size_t Start, size_t End, std::string* Out){ - size_t start = false; - size_t end = false; - - for(size_t i = Start; i < End; i++){ - if(Str[i] == 10 || Str[i] == 13 || Str[i] == 32 || Str[i] == 9)continue; - if(Str[i] == '\"'){ - start = i; - break; - } else { - return false; - } - } - - for(size_t i = End-1; i > Start; i--){ - if(Str[i] == 10 || Str[i] == 13 || Str[i] == 32 || Str[i] == 9)continue; - if(Str[i] == '\"'){ - end = i; - break; - } else { - return false; - } - } - - if(start+1 == end){ - *Out = ""; - return true; - } - - if(start -end -1 == 0)return false; - - Out->assign(Str, start+1, end-start-1); - - for(size_t i = 0; ; i++){ - if((*Out)[i] == '\\' && i < Out->size()-1){ - if((*Out)[i+1] == '\"'){ - Out->replace(i, 2, "\""); - - } else if((*Out)[i+1] == '/'){ - Out->replace(i, 2, "/"); - - } else if((*Out)[i+1] == '\\'){ - Out->replace(i, 2, "\\"); - - } else if((*Out)[i+1] == 'b'){ - Out->replace(i, 2, " "); - (*Out)[i] = 8; - - } else if((*Out)[i+1] == 'f'){ - Out->replace(i, 2, " "); - (*Out)[i] = 12; - - } else if((*Out)[i+1] == 'n'){ - Out->replace(i, 2, " "); - (*Out)[i] = 10; - - } else if((*Out)[i+1] == 'r'){ - Out->replace(i, 2, " "); - (*Out)[i] = 13; - - } else if((*Out)[i+1] == 'u' && i < Out->size()-5){ - Out->replace(i, 5, unicodeToUtf8(*Out, i+2)); - i++; - } - } - if(i >= Out->size()-1)break; - } - - return true; -} - -///============================================================================= -static bool getKey(const std::string& Str, size_t Start, size_t End, std::string* Key){ - size_t start = false; - size_t end = false; - for(size_t i = Start; i < End; i++){ - if(Str[i] == 10 || Str[i] == 13 || Str[i] == 32 || Str[i] == 9)continue; - if(Str[i] == '\"'){ - start = i; - break; - } else { - return false; - } - } - - for(size_t i = End-1; i > Start; i--){ - if(Str[i] == 10 || Str[i] == 13 || Str[i] == 32 || Str[i] == 9)continue; - if(Str[i] == '\"'){ - end = i; - break; - } else { - return false; - } - } - - Key->assign(Str, start+1, end-start-1); - return true; -} - -///============================================================================= -static bool checkIfInt(const std::string& Str, size_t Start, size_t End){ - for(size_t i = Start; i < End; i++){ - if(Str[i] == 10 || Str[i] == 13 || Str[i] == 32 || Str[i] == 9)continue; - if(!((Str[i] >= '0' && Str[i] <= '9') || Str[i] == '-')){ - return false; - } - } - return true; -} - -///============================================================================= -static bool checkIfFloat(const std::string& Str, size_t Start, size_t End){ - for(size_t i = Start; i < End; i++){ - if(Str[i] == 10 || Str[i] == 13 || Str[i] == 32 || Str[i] == 9)continue; - if(!((Str[i] >= '0' && Str[i] <= '9') || Str[i] == '-' || Str[i] == '+' || Str[i] == '.' || Str[i] == 'e' || Str[i] == 'E')){ - return false; - } - } - return true; -} - -///============================================================================= -static bool checkIfBool(const std::string& Str, size_t Start, size_t End, bool* Bool){ - bool start = false; - bool found = false; - for(size_t i = Start; i < End; i++){ - if(!start && (Str[i] == 10 || Str[i] == 13 || Str[i] == 32 || Str[i] == 9))continue; - start = true; - if(Str[i] == 't' || Str[i] == 'T'){ - if(i+3 > End)return false; - if((Str[i+1] == 'r' && Str[i+2] == 'u' && Str[i+3] == 'e') || (Str[i+1] == 'R' && Str[i+2] == 'U' && Str[i+3] == 'E')){ - found = true; - *Bool = true; - i += 3; - continue; - } - } else if(Str[i] == 'f' || Str[i] == 'F'){ - if(i+4 > End)return false; - if((Str[i+1] == 'a' && Str[i+2] == 'l' && Str[i+3] == 's' && Str[i+4] == 'e') || (Str[i+1] == 'A' && Str[i+2] == 'L' && Str[i+3] == 'S' && Str[i+4] == 'E')){ - found = true; - *Bool = false; - i += 4; - continue; - } - } - if(found && !(Str[i] == 10 || Str[i] == 13 || Str[i] == 32 || Str[i] == 9))return false; - } - return found; -} - -///============================================================================= -static bool checkIfString(const std::string& Str, size_t Start, size_t End){ - bool start = false; - bool end = false; - for(size_t i = Start; i < End; i++){ - if(!start && (Str[i] == 10 || Str[i] == 13 || Str[i] == 32 || Str[i] == 9))continue; - start = true; - if(Str[i] != '\"'){ - return false; - } else break; - } - - for(size_t i = End-1; i > Start; i--){ - if(!end && (Str[i] == 10 || Str[i] == 13 || Str[i] == 32 || Str[i] == 9))continue; - end = true; - if(Str[i] != '\"'){ - return false; - } else break; - } - - return true; -} - -///============================================================================= -static bool checkIfObject(const std::string& Str, size_t Start, size_t End){ - bool start = false; - bool end = false; - for(size_t i = Start; i < End; i++){ - if(!start && (Str[i] == 10 || Str[i] == 13 || Str[i] == 32 || Str[i] == 9))continue; - start = true; - if(Str[i] != '{'){ - return false; - } else break; - } - - for(size_t i = End-1; i > Start; i--){ - if(!end && (Str[i] == 10 || Str[i] == 13 || Str[i] == 32 || Str[i] == 9))continue; - end = true; - if(Str[i] != '}'){ - return false; - } else break; - } - - return true; -} - -///============================================================================= -static bool checkIfArray(const std::string& Str, size_t Start, size_t End){ - bool start = false; - bool end = false; - for(size_t i = Start; i < End; i++){ - if(!start && (Str[i] == 10 || Str[i] == 13 || Str[i] == 32 || Str[i] == 9))continue; - start = true; - if(Str[i] != '['){ - return false; - } else break; - } - - for(size_t i = End-1; i > Start; i--){ - if(!end && (Str[i] == 10 || Str[i] == 13 || Str[i] == 32 || Str[i] == 9))continue; - end = true; - if(Str[i] != ']'){ - return false; - } else break; - } - - return true; -} - -///============================================================================= -static bool checkIfNull(const std::string& Str, size_t Start, size_t End){ - bool start = false; - bool found = false; - for(size_t i = Start; i < End; i++){ - if(!start && (Str[i] == 10 || Str[i] == 13 || Str[i] == 32 || Str[i] == 9))continue; - start = true; - if(Str[i] == 'n' || Str[i] == 'N'){ - if(i+3 > End)return false; - if((Str[i+1] == 'u' && Str[i+2] == 'l' && Str[i+3] == 'l') || (Str[i+1] == 'U' && Str[i+2] == 'L' && Str[i+3] == 'L')){ - found = true; - i += 3; - continue; - } - } - if(found && !(Str[i] == 10 || Str[i] == 13 || Str[i] == 32 || Str[i] == 9))return false; - } - return found; -} - -///============================================================================= -static void parse(const std::string& Str, size_t Start, size_t End, ffw::var* Output){ - if(Start+1 == End)return; - bool isArray = false; - if(Str[Start] == '['){ - isArray = true; - } - - std::vector commas; - int brackets = 0; - bool insideString = false; - - for(size_t i = Start+1; i < End; i++){ - if (Str[i] == '{')brackets++; - else if(Str[i] == '}')brackets--; - else if(Str[i] == '[')brackets++; - else if(Str[i] == ']')brackets--; - - /*if((i > Start+1 && Str[i] == '\"' && Str[i-1] != '\\') || (i == Start+1 && Str[i] == '\"')){ - if(!insideString)insideString = true; - else if(insideString)insideString = false; - }*/ - - if(Str[i] == '\"'){ - - if( ((i == Start) || (i == Start+1 && Str[i-1] != '\\')) || - ((i > Start+1) && ((Str[i-1] == '\\' && Str[i-2] == '\\') || (Str[i-1] != '\\'))) ){ - if(!insideString)insideString = true; - else if(insideString)insideString = false; - } - } - - if(!insideString && brackets == 0 && Str[i] == ','){ - commas.push_back(i); - } - } - - if(isArray){ - *Output = ffw::varArray(); - } else { - *Output = ffw::varObject(); - } - - size_t i = 0; - while(true){ - size_t pos = 0; - size_t length = 0; - - if(commas.size() == 0){ - pos = Start+1; - length = End - pos; - } else { - if(i == 0){ - pos = Start+1; - length = commas[i] - pos; - } else if(i > 0 && i < commas.size()){ - pos = commas[i-1]+1; - length = commas[i] - (commas[i-1]+1); - } else { - pos = commas[i-1]+1; - length = End - (commas[i-1]+1); - } - i++; - } - - if(isArray){ - bool boolean; - if(checkIfInt(Str, pos, pos+length)){ - fixSpaces(Str, &pos, &length); - Output->getAsArray().push_back(ffw::stringToVal(Str.substr(pos, pos-length))); - - } else if(checkIfFloat(Str, pos, pos+length)){ - fixSpaces(Str, &pos, &length); - Output->getAsArray().push_back(ffw::stringToVal(Str.substr(pos, pos-length))); - - } else if(checkIfBool(Str, pos, pos+length, &boolean)){ - Output->getAsArray().push_back(boolean); - - } else if(checkIfString(Str, pos, pos+length)){ - std::string newStr; - parseString(Str, pos, pos+length, &newStr); - Output->getAsArray().push_back(newStr); - - } else if(checkIfNull(Str, pos, pos+length)){ - Output->getAsArray().push_back(nullptr); - - } else if(checkIfArray(Str, pos, pos+length)){ - size_t newBegin = pos; - size_t newEnd = pos+length; - for(size_t i = newBegin; i < newEnd; i++){ - if(Str[i] == '['){newBegin = i;break;} - } - for(size_t i = newEnd-1; i > newBegin; i--){ - if(Str[i] == ']'){newEnd = i;break;} - } - - Output->getAsArray().push_back(ffw::var()); - parse(Str, newBegin, newEnd, &Output->getAsArray().at(Output->getAsArray().size()-1)); - - } else if(checkIfObject(Str, pos, pos+length)){ - size_t newBegin = pos; - size_t newEnd = pos+length; - for(size_t i = newBegin; i < newEnd; i++){ - if(Str[i] == '{'){newBegin = i;break;} - } - for(size_t i = newEnd-1; i > newBegin; i--){ - if(Str[i] == '}'){newEnd = i;break;} - } - - Output->getAsArray().push_back(ffw::var()); - parse(Str, newBegin, newEnd, &Output->getAsArray().at(Output->getAsArray().size()-1)); - - } else { - return; - } - - } else { - size_t collon = findCollon(Str, pos, pos+length); - if(collon == 0){ - return; - } - - std::string key; - if(!getKey(Str, pos, collon, &key)){ - return; - } - key = parseStringSimple(key); - - bool boolean; - - if(checkIfInt(Str, collon+1, pos+length)){ - Output->getAsObject().insert(std::pair(key, ffw::stringToVal(Str.substr(collon+1, (pos+length)-collon-1)))); - - } else if(checkIfFloat(Str, collon+1, pos+length)){ - Output->getAsObject().insert(std::pair(key, ffw::stringToVal(Str.substr(collon+1, (pos+length)-collon-1)))); - - } else if(checkIfBool(Str, collon+1, pos+length, &boolean)){ - Output->getAsObject().insert(std::pair(key, boolean)); - - } else if(checkIfString(Str, collon+1, pos+length)){ - std::string newStr; - parseString(Str, collon+1, pos+length, &newStr); - Output->getAsObject().insert(std::pair(key, newStr)); - - } else if(checkIfNull(Str, collon+1, pos+length)){ - Output->getAsObject().insert(std::pair(key, nullptr)); - - } else if(checkIfArray(Str, collon+1, pos+length)){ - size_t newBegin = collon+1; - size_t newEnd = pos+length; - - for(size_t i = newBegin; i < newEnd; i++){ - if(Str[i] == '['){newBegin = i;break;} - } - for(size_t i = newEnd-1; i >= newBegin; i--){ - if(Str[i] == ']'){newEnd = i;break;} - } - - Output->getAsObject().insert(std::pair(key, ffw::var())); - parse(Str, newBegin, newEnd, &Output->getAsObject().at(key)); - - } else if(checkIfObject(Str, collon+1, pos+length)){ - size_t newBegin = collon+1; - size_t newEnd = pos+length; - - for(size_t i = newBegin; i < newEnd; i++){ - if(Str[i] == '{'){newBegin = i;break;} - } - for(size_t i = newEnd-1; i > newBegin; i--){ - if(Str[i] == '}'){newEnd = i;break;} - } - - Output->getAsObject().insert(std::pair(key, ffw::var())); - parse(Str, newBegin, newEnd, &Output->getAsObject().at(key)); - - } else { - return; - } - } - - if(commas.size() == 0)break; - else if(i == commas.size()+1)break; - } -} - -///============================================================================= -static void encodeJSONFunc(std::string* Output, ffw::var* Var, bool Formated, std::string& Indent, bool EscapeUnicode){ - ffw::var::type varType = Var->getType(); - - if(varType == ffw::var::type::vString){ - (*Output) += "\"" + escapeString(Var->getAsString(), EscapeUnicode) + "\""; - - } else if(varType == ffw::var::type::vInt){ - (*Output) += ffw::valToString(Var->getAsInt()); - - } else if(varType == ffw::var::type::vFloat){ - (*Output) += ffw::valToString(Var->getAsFloat()); - - } else if(varType == ffw::var::type::vBool){ - if(Var->getAsBool())(*Output) += "true"; - else (*Output) += "false"; - - } else if(varType == ffw::var::type::vNull){ - (*Output) += "null"; - - } else if(varType == ffw::var::type::vArray){ - if(Formated){ - (*Output) += "[\n"; - Indent += " "; - } else { - (*Output) += "["; - } - - for(size_t i = 0; i < Var->getAsArray().size(); i++){ - if(Formated)(*Output) += Indent; - encodeJSONFunc(Output, &(Var->getAsArray()[i]), Formated, Indent, EscapeUnicode); - if(Formated){ - if(i != Var->getAsArray().size()-1)(*Output) += ",\n"; - else (*Output) += "\n"; - } else { - if(i != Var->getAsArray().size()-1)(*Output) += ","; - } - } - if(Formated){ - Indent = Indent.substr(0, Indent.size()-4); - (*Output) += Indent + "]"; - } else { - (*Output) += "]"; - } - - } else if(varType == ffw::var::type::vObject){ - if(Var->getAsObject().begin() == Var->getAsObject().end()){ - (*Output) += "{}"; - return; - } - - if(Formated){ - (*Output) += "{\n"; - Indent += " "; - } else { - (*Output) += "{"; - } - - auto last = Var->getAsObject().end(); - last--; - for(auto it = Var->getAsObject().begin(); it != Var->getAsObject().end(); it++){ - if(Formated){ - (*Output) += Indent + "\"" + escapeString(it->first, EscapeUnicode) + "\": "; - } else { - (*Output) += "\"" + escapeString(it->first, EscapeUnicode) + "\": "; - } - - encodeJSONFunc(Output, &(it->second), Formated, Indent, EscapeUnicode); - - if(Formated){ - if(it != last)(*Output) += ",\n"; - else (*Output) += "\n"; - } else { - if(it != last)(*Output) += ","; - } - } - - if(Formated){ - Indent = Indent.substr(0, Indent.size()-4); - (*Output) += Indent + "}"; - } else { - (*Output) += "}"; - } - } -} - -///============================================================================= -void ffw::encodeJSON(std::string* Output, ffw::var* Var, bool Formated, bool EscapeUnicode){ - if(Output == NULL)return; - if(Var == NULL)return; - std::string indent; - Output->clear(); - encodeJSONFunc(Output, Var, Formated, indent, EscapeUnicode); -} - -///============================================================================= -bool ffw::decodeJSON(const std::string& Str, ffw::var* Output){ - if(Output == NULL)return false; - if(Str.size() == 0)return false; - - size_t begin = 0; - size_t end = 0; - for(size_t i = 0; i < Str.size(); i++){ - if(Str[i] == '{' || Str[i] == '['){ - begin = i; - break; - } - } - - for(long i = Str.size()-1; i > 0; i--){ - if(Str[i] == '}' || Str[i] == ']'){ - end = i; - break; - } - } - - if(begin == 0 && end == 0)return false; - - if(!((Str[begin] == '{' && Str[end] == '}') || (Str[begin] == '[' && Str[end] == ']'))){ - return false; - } - - parse(Str, begin, end, Output); - - return true; -} - -///============================================================================= -bool ffw::loadJSON(const std::string& Path, ffw::var* Output){ - return loadJSON(utf8ToWstr(Path), Output); -} - -///============================================================================= -bool ffw::loadJSON(const std::wstring& Path, ffw::var* Output){ - if(Output == NULL)return false; - - std::string buffer; - if(!loadTXT(Path, &buffer)){ - return false; - } - - /*ffw::file input; - if(!input.open(Path, false, false, false)){ - return false; - } - - size_t length = input.getSize(); - - if(length == 0)return false; - - std::string buffer; - buffer.resize(length, ' '); - input.read(&buffer[0], length*sizeof(char)); - input.close();*/ - return decodeJSON(buffer, Output); -} - -///============================================================================= -bool ffw::saveJSON(const std::string& Path, ffw::var* Input, bool Formated, bool EscapeUnicode){ - return saveJSON(utf8ToWstr(Path), Input, Formated, EscapeUnicode); -} - -///============================================================================= -bool ffw::saveJSON(const std::wstring& Path, ffw::var* Input, bool Formated, bool EscapeUnicode){ - if(Input == NULL)return false; - - ffw::file output; - if(!output.open(Path, false, true, true)){ - return false; - } - - std::string encoded; - encodeJSON(&encoded, Input, Formated, EscapeUnicode); - - output.write(&encoded[0], encoded.size()); - output.close(); - return true; -} diff --git a/third-party-libs/FragmentFramework/include/utilities/loadSaveObj.cpp b/third-party-libs/FragmentFramework/include/utilities/loadSaveObj.cpp deleted file mode 100644 index f6f7ec5..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/loadSaveObj.cpp +++ /dev/null @@ -1,389 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#include "loadSaveObj.h" -#include "../math/math.h" -#include "../math/stringMath.h" -#include -#include - -///============================================================================= -bool ffw::loadOBJ(const std::string& Path, float** Vertices, unsigned int* NumVertices){ - return loadOBJ(utf8ToWstr(Path), Vertices, NumVertices); -} - -///============================================================================= -bool ffw::loadOBJ(const std::wstring& Path, float** Vertices, unsigned int* NumVertices){ - - std::ifstream file; - file.open(wstrToAnsi(Path), std::ifstream::in); - if(!file){ - //logger().error() << "[File loader] " << path << " failed to open!"; - return false; - } - - std::string temp; - std::vector objectBegin; - std::vector objectEnd; - std::vector vNum; - std::vector vnNum; - std::vector vtNum; - std::vector fNum; - std::vector vertNum; - std::vector texCoordsExists; - std::vector normalsExists; - int objectCount = -1; - int begin = -1; - bool endOfObject = false; - int line = 0; - while(std::getline(file, temp)){ - // If line is a vertice - if (temp[0] == 'v' && temp[1] == ' '){ - if(endOfObject){ - // Found new object - objectBegin.push_back( begin ); - objectEnd.push_back( line-1 ); - begin = -1; - endOfObject = false; - } - if(begin < 0){ - begin = line; - objectCount++; - vNum.push_back(0); - vnNum.push_back(0); - vtNum.push_back(0); - fNum.push_back(0); - vertNum.push_back(0); - texCoordsExists.push_back(false); - normalsExists.push_back(false); - } - vNum[objectCount]++; - - // If line is a normal - } else if (temp[0] == 'v' && temp[1] == 'n'){ - vnNum[objectCount]++; - if(!normalsExists[objectCount])normalsExists[objectCount] = true; - - // If line is a texture coord - } else if (temp[0] == 'v' && temp[1] == 't'){ - vtNum[objectCount]++; - if(!texCoordsExists[objectCount])texCoordsExists[objectCount] = true; - - // If line is a face (triangle or quad) - } else if (temp[0] == 'f' && temp[1] == ' '){ - fNum[objectCount]++; - std::vector tokens = ffw::getTokens(temp, ' '); - if(tokens.size() == 4)vertNum[objectCount] += 3; - else if(tokens.size() == 5)vertNum[objectCount] += 6; - else { - //logger().error() << "[File loader] " << path << " is corrupted!"; - return false; - } - endOfObject = true; - } - line++; - } - objectBegin.push_back( begin ); - objectEnd.push_back( line-1 ); - - /*if(objectCount+1 <= 0){ - logger().error() << "[File loader] " << path << " has no objects!"; - return false; - }*/ - - /*logger().debug() << "[File loader] " << path << " contains: " << objectCount+1 << " objects ->"; - for(int i = 0; i < objectCount+1; i++){ - logger().debug() << "Object ID: " << i << " verices: " << vNum[i] << " normals: " << vnNum[i] << " tex coords: " << vtNum[i] << " faces: " << fNum[i] << " total vertices: " << vertNum[i]; - }*/ - - // Temporary buffers - //float* vert [objectCount+1]; - //float* norm [objectCount+1]; - //float* texCoords [objectCount+1]; - //int* faces [objectCount+1]; - - float** vert = new float*[objectCount + 1]; - float** norm = new float*[objectCount + 1]; - float** texCoords = new float*[objectCount + 1]; - int** faces = new int*[objectCount + 1]; - - // Fill buffers for each object - for(int i = 0; i < objectCount+1; i++){ - file.clear(); - file.seekg(0, file.beg); - line = 0; - - /*if(!normalsExists[i]){ - logger().warning() << "[File loader] " << path << " object: " << i << " has no normals!"; - } - if(!texCoordsExists[i]){ - logger().warning() << "[File loader] " << path << " object: " << i << " has no texure coordinates!"; - }*/ - - // Create buffers - vert[i] = new float[vNum[i]*3]; - if(normalsExists[i]) - norm[i] = new float[vnNum[i]*3]; - if(texCoordsExists[i]) - texCoords[i] = new float[vtNum[i]*2]; - faces[i] = new int[vertNum[i]*3]; - - // Counters - int vNumCount = 0; - int vnNumCount = 0; - int vtNumCount = 0; - int fNumCount = 0; - - while(std::getline(file, temp)){ - // Skip to the begining of the object - if(line < objectBegin[i]){ - line++; - continue; - } - // Get line tokens - std::vector tokens =ffw:: getTokens(temp, ' '); - - // Line is a vertex - if(tokens.size() == 4 && tokens[0] == "v"){ - vert[i][(vNumCount*3) +0] = ffw::stringToVal(tokens[1]); - vert[i][(vNumCount*3) +1] = ffw::stringToVal(tokens[2]); - vert[i][(vNumCount*3) +2] = ffw::stringToVal(tokens[3]); - vNumCount++; - } - // Line is a normal - if(tokens.size() == 4 && tokens[0] == "vn" && normalsExists[i]){ - norm[i][(vnNumCount*3) +0] = ffw::stringToVal(tokens[1]); - norm[i][(vnNumCount*3) +1] = ffw::stringToVal(tokens[2]); - norm[i][(vnNumCount*3) +2] = ffw::stringToVal(tokens[3]); - vnNumCount++; - } - // Line is a texture coord - if(tokens.size() >= 3 && tokens[0] == "vt" && texCoordsExists[i]){ - texCoords[i][(vtNumCount*2) +0] = ffw::stringToVal(tokens[1]); - texCoords[i][(vtNumCount*2) +1] = ffw::stringToVal(tokens[2]); - vtNumCount++; - } - // Line is a face - if(tokens.size() >= 4 && tokens[0] == "f"){ - // Face is a triangle - if(tokens.size() == 4){ - std::vector v0 = ffw::getTokens(tokens[1], '/'); - std::vector v1 = ffw::getTokens(tokens[2], '/'); - std::vector v2 = ffw::getTokens(tokens[3], '/'); - // Check if we get all tokens - if(v0.size() != v1.size() || v0.size() != v2.size()){ - //logger().error() << "[File loader] " << path << " is corrupted at line: " << line; - for(int p = 0; p < objectCount+1; p++){ - delete[] vert[p]; - if(normalsExists[p]) delete[] norm[p]; - if(texCoordsExists[p]) delete[] texCoords[p]; - delete[] faces[p]; - } - delete[] vert; - delete[] norm; - delete[] texCoords; - delete[] faces; - return false; - } - - // No texure coordinates or normals - if(v0.size() == 1){ - faces[i][(fNumCount)+0] = ffw::stringToVal(v2[0]); - faces[i][(fNumCount)+3] = ffw::stringToVal(v1[0]); - faces[i][(fNumCount)+6] = ffw::stringToVal(v0[0]); - - // Texutre coordinates only - } else if(v0.size() == 2 && tokens[1].find("//") == std::string::npos){ - faces[i][(fNumCount)+0] = ffw::stringToVal(v2[0]); faces[i][(fNumCount)+1] = ffw::stringToVal(v2[1]); faces[i][(fNumCount)+2] = -1; - faces[i][(fNumCount)+3] = ffw::stringToVal(v1[0]); faces[i][(fNumCount)+4] = ffw::stringToVal(v1[1]); faces[i][(fNumCount)+5] = -1; - faces[i][(fNumCount)+6] = ffw::stringToVal(v0[0]); faces[i][(fNumCount)+7] = ffw::stringToVal(v0[1]); faces[i][(fNumCount)+8] = -1; - - // Normals only - } else if(v0.size() == 2 && tokens[1].find("//") != std::string::npos){ - faces[i][(fNumCount)+0] = ffw::stringToVal(v2[0]); faces[i][(fNumCount)+1] = -1; faces[i][(fNumCount)+2] = ffw::stringToVal(v2[1]); - faces[i][(fNumCount)+3] = ffw::stringToVal(v1[0]); faces[i][(fNumCount)+4] = -1; faces[i][(fNumCount)+5] = ffw::stringToVal(v1[1]); - faces[i][(fNumCount)+6] = ffw::stringToVal(v0[0]); faces[i][(fNumCount)+7] = -1; faces[i][(fNumCount)+8] = ffw::stringToVal(v0[1]); - // Both - } else { - faces[i][(fNumCount)+0] = ffw::stringToVal(v2[0]); faces[i][(fNumCount)+1] = ffw::stringToVal(v2[1]); faces[i][(fNumCount)+2] = ffw::stringToVal(v2[2]); - faces[i][(fNumCount)+3] = ffw::stringToVal(v1[0]); faces[i][(fNumCount)+4] = ffw::stringToVal(v1[1]); faces[i][(fNumCount)+5] = ffw::stringToVal(v1[2]); - faces[i][(fNumCount)+6] = ffw::stringToVal(v0[0]); faces[i][(fNumCount)+7] = ffw::stringToVal(v0[1]); faces[i][(fNumCount)+8] = ffw::stringToVal(v0[2]); - } - // We have a triangle of 3 vertices, each containing 3 indices - fNumCount += 9; - // Face is a quad - } else if(tokens.size() == 5){ - // Check if we get all tokens - std::vector v0 = ffw::getTokens(tokens[1], '/'); - std::vector v1 = ffw::getTokens(tokens[2], '/'); - std::vector v2 = ffw::getTokens(tokens[3], '/'); - std::vector v3 = ffw::getTokens(tokens[4], '/'); - // Check if we get all tokens - if(v0.size() != v1.size() || v0.size() != v2.size() || v0.size() != v3.size()){ - //logger().error() << "[File loader] " << path << " is corrupted at line: " << line; - for(int p = 0; p < objectCount+1; p++){ - delete[] vert[p]; - if(normalsExists[p]) delete[] norm[p]; - if(texCoordsExists[p]) delete[] texCoords[p]; - delete[] faces[p]; - } - delete[] vert; - delete[] norm; - delete[] texCoords; - delete[] faces; - return false; - } - - // No texure coordinates or normals - if(v0.size() == 1){ - faces[i][(fNumCount*9)+0] = ffw::stringToVal(v2[0]); - faces[i][(fNumCount*9)+3] = ffw::stringToVal(v1[0]); - faces[i][(fNumCount*9)+6] = ffw::stringToVal(v0[0]); - - faces[i][(fNumCount*9)+0+9] = ffw::stringToVal(v3[0]); - faces[i][(fNumCount*9)+3+9] = ffw::stringToVal(v2[0]); - faces[i][(fNumCount*9)+6+9] = ffw::stringToVal(v0[0]); - - // Texutre coordinates only - } else if(v0.size() == 2 && tokens[1].find("//") == std::string::npos){ - faces[i][(fNumCount)+0] = ffw::stringToVal(v2[0]); faces[i][(fNumCount)+1] = -1; faces[i][(fNumCount)+2] = ffw::stringToVal(v2[1]); - faces[i][(fNumCount)+3] = ffw::stringToVal(v1[0]); faces[i][(fNumCount)+4] = -1; faces[i][(fNumCount)+5] = ffw::stringToVal(v1[1]); - faces[i][(fNumCount)+6] = ffw::stringToVal(v0[0]); faces[i][(fNumCount)+7] = -1; faces[i][(fNumCount)+8] = ffw::stringToVal(v0[1]); - - faces[i][(fNumCount)+0+9] = ffw::stringToVal(v3[0]); faces[i][(fNumCount)+1+9] = -1; faces[i][(fNumCount)+2+9] = ffw::stringToVal(v3[1]); - faces[i][(fNumCount)+3+9] = ffw::stringToVal(v2[0]); faces[i][(fNumCount)+4+9] = -1; faces[i][(fNumCount)+5+9] = ffw::stringToVal(v2[1]); - faces[i][(fNumCount)+6+9] = ffw::stringToVal(v0[0]); faces[i][(fNumCount)+7+9] = -1; faces[i][(fNumCount)+8+9] = ffw::stringToVal(v0[1]); - - // Normals only - } else if(v0.size() == 2 && tokens[1].find("//") != std::string::npos){ - faces[i][(fNumCount)+0] = ffw::stringToVal(v2[0]); faces[i][(fNumCount)+1] = ffw::stringToVal(v2[1]); faces[i][(fNumCount)+2] = -1; - faces[i][(fNumCount)+3] = ffw::stringToVal(v1[0]); faces[i][(fNumCount)+4] = ffw::stringToVal(v1[1]); faces[i][(fNumCount)+5] = -1; - faces[i][(fNumCount)+6] = ffw::stringToVal(v0[0]); faces[i][(fNumCount)+7] = ffw::stringToVal(v0[1]); faces[i][(fNumCount)+8] = -1; - - faces[i][(fNumCount)+0+9] = ffw::stringToVal(v3[0]); faces[i][(fNumCount)+1+9] = ffw::stringToVal(v3[1]); faces[i][(fNumCount)+2+9] = -1; - faces[i][(fNumCount)+3+9] = ffw::stringToVal(v2[0]); faces[i][(fNumCount)+4+9] = ffw::stringToVal(v2[1]); faces[i][(fNumCount)+5+9] = -1; - faces[i][(fNumCount)+6+9] = ffw::stringToVal(v0[0]); faces[i][(fNumCount)+7+9] = ffw::stringToVal(v0[1]); faces[i][(fNumCount)+8+9] = -1; - // Both - } else { - faces[i][(fNumCount)+0] = ffw::stringToVal(v2[0]); faces[i][(fNumCount)+1] = ffw::stringToVal(v2[1]); faces[i][(fNumCount)+2] = ffw::stringToVal(v2[2]); - faces[i][(fNumCount)+3] = ffw::stringToVal(v1[0]); faces[i][(fNumCount)+4] = ffw::stringToVal(v1[1]); faces[i][(fNumCount)+5] = ffw::stringToVal(v1[2]); - faces[i][(fNumCount)+6] = ffw::stringToVal(v0[0]); faces[i][(fNumCount)+7] = ffw::stringToVal(v0[1]); faces[i][(fNumCount)+8] = ffw::stringToVal(v0[2]); - - faces[i][(fNumCount)+0+9] = ffw::stringToVal(v3[0]); faces[i][(fNumCount)+1+9] = ffw::stringToVal(v3[1]); faces[i][(fNumCount)+2+9] = ffw::stringToVal(v3[2]); - faces[i][(fNumCount)+3+9] = ffw::stringToVal(v2[0]); faces[i][(fNumCount)+4+9] = ffw::stringToVal(v2[1]); faces[i][(fNumCount)+5+9] = ffw::stringToVal(v2[2]); - faces[i][(fNumCount)+6+9] = ffw::stringToVal(v0[0]); faces[i][(fNumCount)+7+9] = ffw::stringToVal(v0[1]); faces[i][(fNumCount)+8+9] = ffw::stringToVal(v0[2]); - } - // We have a 2 triangles of 3 vertices, each containing 3 indices - fNumCount += 18; - } - } - - line++; - if(line > objectEnd[i])break; - } - - } - - // Get vertex count of all objects - (*NumVertices) = 0; - for(int i = 0; i < objectCount+1; i++){ - (*NumVertices) += vertNum[i]; - } - - // 8 floats per one vertex - // X, Y, Z, Xn, Yn, Zn, U, V - *Vertices = new float[(*NumVertices)*8]; - - // Fill buffer for each object - for(int i = 0; i < objectCount+1; i++){ - int offset = 0; - // For each triangle - for(int f = 0; f < vertNum[i]; f += 3){ - // Calculate normals - ffw::vec3f normal; - //normalsExists[i] = false; - if(!normalsExists[i]){ - int v0Index = faces[i][(f*3)+(0)+0]-1; - int v1Index = faces[i][(f*3)+(3)+0]-1; - int v2Index = faces[i][(f*3)+(6)+0]-1; - - while(v0Index >= vNum[i]) v0Index -= vNum[i]; - while(v1Index >= vNum[i]) v1Index -= vNum[i]; - while(v2Index >= vNum[i]) v2Index -= vNum[i]; - - ffw::vec3f v0; - ffw::vec3f v1; - ffw::vec3f v2; - - v0.x = vert[i][(v0Index*3)+0]; - v0.y = vert[i][(v0Index*3)+1]; - v0.z = vert[i][(v0Index*3)+2]; - - v1.x = vert[i][(v1Index*3)+0]; - v1.y = vert[i][(v1Index*3)+1]; - v1.z = vert[i][(v1Index*3)+2]; - - v2.x = vert[i][(v2Index*3)+0]; - v2.y = vert[i][(v2Index*3)+1]; - v2.z = vert[i][(v2Index*3)+2]; - - ffw::vec3f dir0 = v0 - v1; - ffw::vec3f dir1 = v0 - v2; - normal = ffw::cross(dir0, dir1); - normal.normalize(); - } - - // For each vertex - for(unsigned int v = 0; v < 3; v++){ - int vIndex = faces[i][(f*3)+(v*3)+0]-1; - int nIndex = faces[i][(f*3)+(v*3)+2]-1; - int tIndex = faces[i][(f*3)+(v*3)+1]-1; - - while(vIndex >= vNum[i]) vIndex -= vNum[i]; - (*Vertices)[offset + (f*8)+(v*8)+0] = vert[i][(vIndex*3)+0]; - (*Vertices)[offset + (f*8)+(v*8)+1] = vert[i][(vIndex*3)+1]; - (*Vertices)[offset + (f*8)+(v*8)+2] = vert[i][(vIndex*3)+2]; - - if(!normalsExists[i]){ - (*Vertices)[offset + (f*8)+(v*8)+3] = normal.x; - (*Vertices)[offset + (f*8)+(v*8)+4] = normal.y; - (*Vertices)[offset + (f*8)+(v*8)+5] = normal.z; - } else { - while(nIndex >= vnNum[i]) nIndex -= vnNum[i]; - (*Vertices)[offset + (f*8)+(v*8)+3] = norm[i][(nIndex*3)+0]; - (*Vertices)[offset + (f*8)+(v*8)+4] = norm[i][(nIndex*3)+1]; - (*Vertices)[offset + (f*8)+(v*8)+5] = norm[i][(nIndex*3)+2]; - } - - if(!texCoordsExists[i]){ - (*Vertices)[offset + (f*8)+(v*8)+6] = 0.0f; - (*Vertices)[offset + (f*8)+(v*8)+7] = 0.0f; - } else { - while(tIndex >= vtNum[i]) tIndex -= vtNum[i]; - (*Vertices)[offset + (f*8)+(v*8)+6] = texCoords[i][(tIndex*2)+0]; - (*Vertices)[offset + (f*8)+(v*8)+7] = texCoords[i][(tIndex*2)+1]; - } - } - } - offset += vertNum[i]; - } - - // Delete buffers - for(int i = 0; i < objectCount+1; i++){ - delete[] vert[i]; - if(normalsExists[i]) delete[] norm[i]; - if(texCoordsExists[i]) delete[] texCoords[i]; - delete[] faces[i]; - } - - delete[] vert; - delete[] norm; - delete[] texCoords; - delete[] faces; - - file.close(); - return true; -} diff --git a/third-party-libs/FragmentFramework/include/utilities/loadSaveObj.h b/third-party-libs/FragmentFramework/include/utilities/loadSaveObj.h deleted file mode 100644 index be62f2f..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/loadSaveObj.h +++ /dev/null @@ -1,28 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_LOAD_SAVE_OBJ -#define FFW_LOAD_SAVE_OBJ - -#include "../dll.h" -#include - -/*! - @ingroup Utilities -*/ -namespace ffw{ - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API loadOBJ(const std::string& Path, float** Vertices, unsigned int* NumVertices); - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API loadOBJ(const std::wstring& Path, float** Vertices, unsigned int* NumVertices); -}; -#endif diff --git a/third-party-libs/FragmentFramework/include/utilities/loadSaveOgg.cpp b/third-party-libs/FragmentFramework/include/utilities/loadSaveOgg.cpp deleted file mode 100644 index 0c868ab..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/loadSaveOgg.cpp +++ /dev/null @@ -1,541 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#include "loadSaveOgg.h" -#include "../math/math.h" -#include "../math/stringMath.h" -#include "file.h" -#include "fileUtilities.h" -#include -#include -#include -#include -#include - -#define BYTES_PER_CHUNK 4096 - -///============================================================================= -// Code is adapted from libvorbis example 'decoder_example.c' -static bool loadOggFile(FILE* File, size_t* FinalSize, int* Channels, int* Frequency, float* Data){ - // Sync and verify incoming physical bitstream - ogg_sync_state oy; - // Take physical pages, weld into a logical stream of packets - ogg_stream_state os; - // One Ogg bitstream page. Vorbis packets are inside - ogg_page og; - // One raw packet of data for decode - ogg_packet op; - // Struct that stores all the static vorbis bitstream - vorbis_info vi; - // Struct that stores all the bitstream user comments - vorbis_comment vc; - // Central working state for the packet->PCM decoder - vorbis_dsp_state vd; - // local working space for packet->PCM decode - vorbis_block vb; - - char *buffer; - int bytes; - int convsize = 0; - - ogg_sync_init(&oy); - - // We repeat if the bitstream is chained - while(1){ - int eos=0; - int i; - - // Grab some data at the head of the stream. We want the first page - // (which is guaranteed to be small and only contain the Vorbis - // stream initial header) We need the first page to get the stream - // serialno. - - // Submit a 4k block to libvorbis' Ogg layer - buffer=ogg_sync_buffer(&oy,4096); - bytes=fread(buffer,1,4096,File); - ogg_sync_wrote(&oy,bytes); - - // Get the first page. - if(ogg_sync_pageout(&oy,&og)!=1){ - // Have we simply run out of data? If so, we're done. - if(bytes<4096)break; - - // Error case. Must not be Vorbis data - //std::cout << "Input does not appear to be an Ogg bitstream" << std::endl; - return false; - } - - // Get the serial number and set up the rest of decode. - // Serialno first; use it to set up a logical stream - ogg_stream_init(&os,ogg_page_serialno(&og)); - - // Extract the initial header from the first page and verify that the - // Ogg bitstream is in fact Vorbis data - - vorbis_info_init(&vi); - vorbis_comment_init(&vc); - - if(ogg_stream_pagein(&os,&og)<0){ - // Error; stream version mismatch perhaps - //std::cout << "Error reading first page of Ogg bitstream data" << std::endl; - ogg_stream_clear(&os); - vorbis_comment_clear(&vc); - vorbis_info_clear(&vi); - return false; - } - - if(ogg_stream_packetout(&os,&op)!=1){ - // No page? must not be vorbis - //std::cout << "Error reading initial header packet" << std::endl; - ogg_stream_clear(&os); - vorbis_comment_clear(&vc); - vorbis_info_clear(&vi); - return false; - } - - if(vorbis_synthesis_headerin(&vi,&vc,&op)<0){ - // Error case; not a vorbis header - //std::cout << "This Ogg bitstream does not contain Vorbis audio data" << std::endl; - ogg_stream_clear(&os); - vorbis_comment_clear(&vc); - vorbis_info_clear(&vi); - return false; - } - - // At this point, we're sure we're Vorbis. We've set up the logical - // (Ogg) bitstream decoder. Get the comment and codebook headers and - // set up the Vorbis decoder - - // The next two packets in order are the comment and codebook headers. - // They're likely large and may span multiple pages. Thus we read - // and submit data until we get our two packets, watching that no - // pages are missing. If a page is missing, error out; losing a - // header page is the only place where missing data is fatal. - - i=0; - while(i<2){ - while(i<2){ - int result=ogg_sync_pageout(&oy,&og); - // Need more data - if(result==0)break; - - // Don't complain about missing or corrupt data yet. We'll - // catch it at the packet output phase - if(result==1){ - ogg_stream_pagein(&os,&og); - - // we can ignore any errors here - // as they'll also become apparent - // at packetout - while(i<2){ - result=ogg_stream_packetout(&os,&op); - if(result==0)break; - if(result<0){ - // Uh oh; data at some point was corrupted or missing! - // We can't tolerate that in a header. Die. - //std::cout << "Corrupt secondary header. Exiting..." << std::endl; - ogg_stream_clear(&os); - vorbis_comment_clear(&vc); - vorbis_info_clear(&vi); - return false; - } - result=vorbis_synthesis_headerin(&vi,&vc,&op); - - if(result<0){ - //std::cout << "Corrupt secondary header. Exiting..." << std::endl; - ogg_stream_clear(&os); - vorbis_comment_clear(&vc); - vorbis_info_clear(&vi); - return false; - } - - i++; - } - } - } - // No harm in not checking before adding more */ - buffer=ogg_sync_buffer(&oy,4096); - bytes=fread(buffer,1,4096,File); - - if(bytes==0 && i<2){ - //std::cout << "End of file before finding all Vorbis headers!" << std::endl; - ogg_stream_clear(&os); - vorbis_comment_clear(&vc); - vorbis_info_clear(&vi); - return false; - } - - ogg_sync_wrote(&oy,bytes); - } - - // Throw the comments plus a few lines about the bitstream we're decoding - //char **ptr=vc.user_comments; - //while(*ptr){ - // std::cout << *ptr << std::endl; - // ++ptr; - //} - //std::cout << "Bitstream is " << vi.channels << " channel, " << vi.rate << std::endl; - //std::cout << "Encoded by: " << vc.vendor << std::endl; - *Channels = vi.channels; - *Frequency = vi.rate; - - convsize=4096/vi.channels; - - // OK, got and parsed all three headers. Initialize the Vorbis - // packet->PCM decoder. - - if(vorbis_synthesis_init(&vd,&vi)==0){ - // Central decode state - vorbis_block_init(&vd,&vb); - - // local state for most of the decode - // so multiple block decodes can - // proceed in parallel. We could init - // multiple vorbis_block structures - // for vd here - - // The rest is just a straight decode loop until end of stream - while(!eos){ - while(!eos){ - int result=ogg_sync_pageout(&oy,&og); - // Need more data - if(result==0)break; - // Missing or corrupt data at this page position - if(result<0){ - //std::cout << "Corrupt or missing data in bitstream continuing..." << std::endl; - - } else { - ogg_stream_pagein(&os,&og); - // Can safely ignore errors at this point - while(1){ - result=ogg_stream_packetout(&os,&op); - - if(result==0)break; - // need more data - if(result<0){ - // Missing or corrupt data at this page position - // No reason to complain; already complained above - } else { - - // We have a packet. Decode it - float **pcm; - int samples; - - // Test for success! - if(vorbis_synthesis(&vb,&op)==0) - vorbis_synthesis_blockin(&vd,&vb); - - // **pcm is a multichannel float vector. In stereo, for - // example, pcm[0] is left, and pcm[1] is right. samples is - // the size of each channel. Convert the float values - // (-1.<=range<=1.) to whatever PCM format and write it out - - while((samples=vorbis_synthesis_pcmout(&vd,&pcm))>0){ - - int bout=(samplesPCM decoder - vorbis_dsp_state vd; - // Local working space for packet->PCM decode - vorbis_block vb; - - int eos=0; - int ret; - - vorbis_info_init(&vi); - - // Encoding using an average bitrate mode (ABR). - // example: 44kHz stereo coupled, average 128kbps VBR - // ret = vorbis_encode_init(&vi,2,44100,-1,128000,-1); - - ret = vorbis_encode_init(&vi, NumChannels, SampleRate, -1, ByteRate*8, -1); - - // do not continue if setup failed; this can happen if we ask for a - // mode that libVorbis does not support (eg, too low a bitrate, etc, - // will return 'OV_EIMPL') - - if(ret){ - vorbis_info_clear(&vi); - fclose(output); - return false; - } - - // Add a comment - vorbis_comment_init(&vc); - vorbis_comment_add_tag(&vc, "ENCODER", "vorbis"); - - // set up the analysis state and auxiliary encoding storage - vorbis_analysis_init(&vd,&vi); - vorbis_block_init(&vd,&vb); - - // Set up our packet->stream encoder - // Pick a random serial number; that way we can more likely build - // chained streams just by concatenation - - srand((unsigned int)time(NULL)); - ogg_stream_init(&os, rand()); - - // Vorbis streams begin with three headers; the initial header (with - // most of the codec setup parameters) which is mandated by the Ogg - // bitstream spec. The second header holds any comment fields. The - // third header holds the bitstream codebook. We merely need to - // make the headers, then pass them to libvorbis one at a time; - // libvorbis handles the additional Ogg bitstream constraints - - ogg_packet header; - ogg_packet header_comm; - ogg_packet header_code; - - vorbis_analysis_headerout(&vd,&vc,&header,&header_comm,&header_code); - - // automatically placed in its own page - ogg_stream_packetin(&os,&header); - ogg_stream_packetin(&os,&header_comm); - ogg_stream_packetin(&os,&header_code); - - // This ensures the actual - // audio data will start on a new page, as per spec - - while(!eos){ - int result=ogg_stream_flush(&os,&og); - if(result==0)break; - fwrite(og.header,1,og.header_len,output); - fwrite(og.body,1,og.body_len,output); - } - - float* dataPtr = (float*)Data; - size_t totalSamples = (Size/NumChannels) / (BitsPerSample/8); - - size_t samplesLeft = totalSamples; - size_t samplesWritten = 0; - while(!eos){ - long i; - // stereo hardwired here - //long bytes = fread(readbuffer,1,READ*4,stdin); - - long bytes = BYTES_PER_CHUNK; - if(samplesLeft < BYTES_PER_CHUNK){ - bytes = samplesLeft; - } - samplesLeft -= bytes; - - if(bytes==0){ - // end of file. this can be done implicitly in the mainline, - // but it's easier to see here in non-clever fashion. - // Tell the library we're at end of stream so that it can handle - // the last frame and mark end of stream in the output properly - vorbis_analysis_wrote(&vd,0); - - } else { - // data to encode - - // expose the buffer to submit data - float **buffer=vorbis_analysis_buffer(&vd, BYTES_PER_CHUNK); - - // uninterleave samples - for(i = 0; i < bytes; i++){ - /*buffer[0][i]=((readbuffer[i*4+1]<<8)| - (0x00ff&(int)readbuffer[i*4]))/32768.f; - buffer[1][i]=((readbuffer[i*4+3]<<8)| - (0x00ff&(int)readbuffer[i*4+2]))/32768.f;*/ - for(int c = 0; c < NumChannels; c++){ - buffer[c][i] = dataPtr[samplesWritten]; - samplesWritten++; - } - } - - // tell the library how much we actually submitted - vorbis_analysis_wrote(&vd, i); - } - - // vorbis does some data preanalysis, then divvies up blocks for - // more involved (potentially parallel) processing. Get a single - // block for encoding now - while(vorbis_analysis_blockout(&vd,&vb)==1){ - - // analysis, assume we want to use bitrate management - vorbis_analysis(&vb,NULL); - vorbis_bitrate_addblock(&vb); - - while(vorbis_bitrate_flushpacket(&vd,&op)){ - - // weld the packet into the bitstream - ogg_stream_packetin(&os,&op); - - // write out pages (if any) - while(!eos){ - int result=ogg_stream_pageout(&os,&og); - if(result==0)break; - fwrite(og.header,1,og.header_len,output); - fwrite(og.body,1,og.body_len,output); - - // this could be set above, but for illustrative purposes, I do - // it here (to show that vorbis does know where the stream ends) - - if(ogg_page_eos(&og))eos=1; - } - } - } - } - - // clean up and exit. vorbis_info_clear() must be called last - - ogg_stream_clear(&os); - vorbis_block_clear(&vb); - vorbis_dsp_clear(&vd); - vorbis_comment_clear(&vc); - vorbis_info_clear(&vi); - - // ogg_page and ogg_packet structs always point to storage in - // libvorbis. They're never freed or manipulated directly - - fclose(output); - return true; -} diff --git a/third-party-libs/FragmentFramework/include/utilities/loadSaveOgg.h b/third-party-libs/FragmentFramework/include/utilities/loadSaveOgg.h deleted file mode 100644 index 6765894..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/loadSaveOgg.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_LOAD_SAVE_OGG -#define FFW_LOAD_SAVE_OGG - -#include "../dll.h" -#include - -/*! - @ingroup Utilities -*/ -namespace ffw{ - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API loadOGG(const std::string& Path, unsigned char** Data, int* BitsPerSample, size_t* Size, int* ByteRate, int* SampleRate, int* NumChannels); - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API saveOGG(const std::string& Path, unsigned char* Data, int BitsPerSample, size_t Size, int ByteRate, int SampleRate, int NumChannels); - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API loadOGG(const std::wstring& Path, unsigned char** Data, int* BitsPerSample, size_t* Size, int* ByteRate, int* SampleRate, int* NumChannels); - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API saveOGG(const std::wstring& Path, unsigned char* Data, int BitsPerSample, size_t Size, int ByteRate, int SampleRate, int NumChannels); -}; -#endif - - diff --git a/third-party-libs/FragmentFramework/include/utilities/loadSavePbm.cpp b/third-party-libs/FragmentFramework/include/utilities/loadSavePbm.cpp deleted file mode 100644 index 8420b0d..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/loadSavePbm.cpp +++ /dev/null @@ -1,237 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#include "loadSavePbm.h" -#include "../math/math.h" -#include "../math/stringMath.h" -#include "file.h" - -///============================================================================= -bool ffw::loadPBM(const std::string& Path, unsigned char** Pixels, int* Width, int* Height, ffw::imageType* Type){ - return loadPBM(utf8ToWstr(Path), Pixels, Width, Height, Type); -} - -///============================================================================= -bool ffw::loadPBM(const std::wstring& Path, unsigned char** Pixels, int* Width, int* Height, ffw::imageType* Type){ - file input; - if(!input.open(Path, true, false, false)){ - return false; - } - - // Check if file is big enough to contain header - size_t size = input.getSize(); - - std::string header[4]; - - input.readLine(&header[0]); - input.readLine(&header[1]); - input.readLine(&header[2]); - input.readLine(&header[3]); - - if(header[0].size() == 0 || header[1].size() == 0 || header[2].size() == 0 || header[3].size() == 0)return false; - - uint32_t width = stringToVal(header[1]); - uint32_t height = stringToVal(header[2]); - imageType type; - - uint32_t offset = input.getPos(); - uint32_t dataLength = 0; - uint32_t scanline = 0; - - if(header[0] == "P6" && header[3] == "255"){ - type = imageType::RGB_888; - dataLength = width*height*3; - scanline = width*3; - if(offset + dataLength > size)return false; - } else if(header[0] == "P6" && header[3] == "65535"){ - type = imageType::RGB_161616; - dataLength = width*height*6; - scanline = width*6; - if(offset + dataLength > size)return false; - } else if(header[0] == "PF" && header[3] == "-1.0000"){ - type = imageType::RGB_323232; - dataLength = width*height*12; - scanline = width*12; - if(offset + dataLength > size)return false; - } else if(header[0] == "P5" && header[3] == "255"){ - type = imageType::GRAYSCALE_8; - dataLength = width*height; - scanline = width; - if(offset + dataLength > size)return false; - } else if(header[0] == "P5" && header[3] == "65535"){ - type = imageType::GRAYSCALE_16; - dataLength = width*height*2; - scanline = width*2; - if(offset + dataLength > size)return false; - } else if(header[0] == "Pf" && header[3] == "-1.0000"){ - type = imageType::GRAYSCALE_32; - dataLength = width*height*4; - scanline = width*4; - if(offset + dataLength > size)return false; - } else { - return false; - } - - if(Width != NULL)*Width = width; - if(Height != NULL)*Height = height; - if(Type != NULL)*Type = type; - - if(Pixels == NULL)return true; - - if(type == imageType::GRAYSCALE_8){ - *Pixels = new uint8_t[width*height]; - } else if(type == imageType::GRAYSCALE_16){ - *Pixels = new uint8_t[width*height*2]; - } else if(type == imageType::GRAYSCALE_32){ - *Pixels = new uint8_t[width*height*4]; - } else if(type == imageType::RGB_888){ - *Pixels = new uint8_t[width*height*3]; - } else if(type == imageType::RGB_161616){ - *Pixels = new uint8_t[width*height*6]; - } else if(type == imageType::RGB_323232){ - *Pixels = new uint8_t[width*height*12]; - } - - for(uint32_t row = 0; row < height; row++){ - input.gotoPos(offset + (height -row -1)*scanline); - input.read(&(*Pixels)[row*scanline], scanline); - } - - if(type == imageType::GRAYSCALE_16){ - for(uint32_t i = 0; i < width*height*2; i += 2){ - uint8_t temp = (*Pixels)[i]; - (*Pixels)[i] = (*Pixels)[i+1]; - (*Pixels)[i+1] = temp; - } - } else if(type == imageType::RGB_161616){ - for(uint32_t i = 0; i < width*height*6; i += 6){ - uint8_t tempR = (*Pixels)[i]; - (*Pixels)[i] = (*Pixels)[i+1]; - (*Pixels)[i+1] = tempR; - - uint8_t tempG = (*Pixels)[i+2]; - (*Pixels)[i+2] = (*Pixels)[i+3]; - (*Pixels)[i+3] = tempG; - - uint8_t tempB = (*Pixels)[i+4]; - (*Pixels)[i+4] = (*Pixels)[i+5]; - (*Pixels)[i+5] = tempB; - } - } - - return true; -} - -///============================================================================= -bool ffw::savePBM(const std::string& Path, unsigned char* Pixels, int Width, int Height, ffw::imageType Type){ - return savePBM(utf8ToWstr(Path), Pixels, Width, Height, Type); -} - -///============================================================================= -bool ffw::savePBM(const std::wstring& Path, unsigned char* Pixels, int Width, int Height, ffw::imageType Type){ - if(Pixels == NULL)return false; - if(Width == 0 || Height == 0)return false; - - if(!(Type == imageType::GRAYSCALE_8 || - Type == imageType::GRAYSCALE_16 || - Type == imageType::GRAYSCALE_32 || - Type == imageType::RGB_888 || - Type == imageType::RGB_161616 || - Type == imageType::RGB_323232))return false; - - file output; - if(!output.open(Path, true,true, true)){ - return false; - } - - std::string header[4]; - uint32_t scanline = 0; - - if(Type == imageType::GRAYSCALE_8){ - header[0] = "P5"; - header[3] = "255"; - scanline = Width; - } else if(Type == imageType::GRAYSCALE_16){ - header[0] = "P5"; - header[3] = "65535"; - scanline = Width*2; - } else if(Type == imageType::GRAYSCALE_32){ - header[0] = "Pf"; - header[3] = "-1.0000"; - scanline = Width*4; - } else if(Type == imageType::RGB_888){ - header[0] = "P6"; - header[3] = "255"; - scanline = Width*3; - } else if(Type == imageType::RGB_161616){ - header[0] = "P6"; - header[3] = "65535"; - scanline = Width*6; - } else if(Type == imageType::RGB_323232){ - header[0] = "PF"; - header[3] = "-1.0000"; - scanline = Width*12; - } - - header[1] = valToString(Width); - header[2] = valToString(Height); - - output.writeLine(header[0]); - output.writeLine(header[1]); - output.writeLine(header[2]); - output.writeLine(header[3]); - - uint32_t offset = output.getPos(); - - // Fill whole file - for(int row = 0; row < Height; row++){ - output.write(Pixels, scanline); - } - - uint8_t* rowPtr = NULL; - - if(Type == imageType::GRAYSCALE_16){ - rowPtr = new uint8_t[Width*2]; - } else if(Type == imageType::RGB_161616){ - rowPtr = new uint8_t[Width*6]; - } - - // Save rows in reverse order - for(int row = 0; row < Height; row++){ - output.gotoPos(offset + (Height -row -1)*scanline); - - if(Type == imageType::GRAYSCALE_16){ - uint8_t* tempPtr = &Pixels[row*scanline]; - for(int i = 0; i < Width*2; i += 2){ - rowPtr[i+0] = tempPtr[i+1]; - rowPtr[i+1] = tempPtr[i+0]; - } - } else if(Type == imageType::RGB_161616){ - uint8_t* tempPtr = &Pixels[row*scanline]; - for(int i = 0; i < Width*6; i += 6){ - rowPtr[i+0] = tempPtr[i+1]; - rowPtr[i+1] = tempPtr[i+0]; - - rowPtr[i+2] = tempPtr[i+3]; - rowPtr[i+3] = tempPtr[i+2]; - - rowPtr[i+4] = tempPtr[i+5]; - rowPtr[i+5] = tempPtr[i+4]; - } - } else { - rowPtr = &Pixels[row*scanline]; - } - - output.write(rowPtr, scanline); - } - - if(Type == imageType::GRAYSCALE_16 || Type == imageType::RGB_161616){ - delete[] rowPtr; - } - - return true; -} - diff --git a/third-party-libs/FragmentFramework/include/utilities/loadSavePbm.h b/third-party-libs/FragmentFramework/include/utilities/loadSavePbm.h deleted file mode 100644 index 9843783..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/loadSavePbm.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_LOAD_SAVE_PBM -#define FFW_LOAD_SAVE_PBM - -#include "../dll.h" -#include -#include "fileUtilities.h" - -/*! - @ingroup Utilities -*/ -namespace ffw{ - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API loadPBM(const std::string& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type); - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API savePBM(const std::string& Path, unsigned char* Pixels, int Width, int Height, imageType Type); - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API loadPBM(const std::wstring& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type); - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API savePBM(const std::wstring& Path, unsigned char* Pixels, int Width, int Height, imageType Type); -}; -#endif diff --git a/third-party-libs/FragmentFramework/include/utilities/loadSavePng.cpp b/third-party-libs/FragmentFramework/include/utilities/loadSavePng.cpp deleted file mode 100644 index 1c2305f..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/loadSavePng.cpp +++ /dev/null @@ -1,346 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#include "loadSavePng.h" -#include "../math/math.h" -#include "../math/stringMath.h" -#include "file.h" -#include -#include - -static void user_error_fn(png_structp png_ptr, png_const_charp error_msg){ -} - -static void user_warning_fn(png_structp png_ptr, png_const_charp warning_msg){ -} - -///============================================================================= -bool ffw::loadPNG(const std::string& Path, unsigned char** Pixels, int* Width, int* Height, ffw::imageType* Type){ - return loadPNG(utf8ToWstr(Path), Pixels, Width, Height, Type); -} - -///============================================================================= -bool ffw::loadPNG(const std::wstring& Path, unsigned char** Pixels, int* Width, int* Height, ffw::imageType* Type){ - FILE *inputFile = _wfopen(Path.c_str(), L"rb"); - if(!inputFile)return false; - - uint8_t* header = new uint8_t[8]; - fread(header, 1, 8, inputFile); - - - if(png_sig_cmp(header, 0, 8)){ - fclose(inputFile); - return false; - } - - png_structp pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, user_error_fn, user_warning_fn); - - if(!pngPtr){ - fclose(inputFile); - return false; - } - - png_infop infoPtr = png_create_info_struct(pngPtr); - if(!infoPtr){ - fclose(inputFile); - return false; - } - - if(setjmp(png_jmpbuf(pngPtr))){ - fclose(inputFile); - return false; - } - - png_init_io(pngPtr, inputFile); - png_set_sig_bytes(pngPtr, 8); - - png_read_info(pngPtr, infoPtr); - - int width = png_get_image_width(pngPtr, infoPtr); - int height = png_get_image_height(pngPtr, infoPtr); - png_byte colorType = png_get_color_type(pngPtr, infoPtr); - png_byte bitDepth = png_get_bit_depth(pngPtr, infoPtr); - - //if(bitDepth == 16) - //png_set_strip_16(pngPtr); - - if (bitDepth == 16) - png_set_swap(pngPtr); - - if(colorType == PNG_COLOR_TYPE_PALETTE) - png_set_palette_to_rgb(pngPtr); - - imageType type; - - if(bitDepth == 1){ - if(colorType == PNG_COLOR_TYPE_GRAY){ - type = imageType::GRAYSCALE_8; - } else { - fclose(inputFile); - return false; - } - } else if(bitDepth == 4){ - if(colorType == PNG_COLOR_TYPE_GRAY){ - type = imageType::GRAYSCALE_8; - } else { - fclose(inputFile); - return false; - } - - } else if(bitDepth == 8){ - if(colorType == PNG_COLOR_TYPE_GRAY){ - type = imageType::GRAYSCALE_8; - - } else if(colorType == PNG_COLOR_TYPE_GRAY_ALPHA){ - type = imageType::GRAYSCALE_ALPHA_8; - - } else if(colorType == PNG_COLOR_TYPE_RGB){ - type = imageType::RGB_888; - - } else if(colorType == PNG_COLOR_TYPE_RGB_ALPHA){ - type = imageType::RGB_ALPHA_8888; - - } else if(colorType == PNG_COLOR_TYPE_PALETTE){ - type = imageType::RGB_888; - - } else { - fclose(inputFile); - return false; - } - - } else if(bitDepth == 16){ - if(colorType == PNG_COLOR_TYPE_GRAY){ - type = imageType::GRAYSCALE_16; - - } else if(colorType == PNG_COLOR_TYPE_GRAY_ALPHA){ - type = imageType::GRAYSCALE_ALPHA_16; - - } else if(colorType == PNG_COLOR_TYPE_RGB){ - type = imageType::RGB_161616; - - } else if(colorType == PNG_COLOR_TYPE_RGB_ALPHA){ - type = imageType::RGB_ALPHA_16161616; - - } else { - fclose(inputFile); - return false; - } - - } else { - fclose(inputFile); - return false; - } - - // PNG_COLOR_TYPE_GRAY_ALPHA is always 8 or 16bit depth - if(colorType == PNG_COLOR_TYPE_GRAY && bitDepth < 8){ - png_set_expand_gray_1_2_4_to_8(pngPtr); - } - - if(png_get_valid(pngPtr, infoPtr, PNG_INFO_tRNS)){ - png_set_tRNS_to_alpha(pngPtr); - } - - // Fill background color if image does not have transparency - /*if(colorType == PNG_COLOR_TYPE_RGB || colorType == PNG_COLOR_TYPE_GRAY || colorType == PNG_COLOR_TYPE_PALETTE){ - png_set_filler(pngPtr, 0xFF, PNG_FILLER_AFTER); - }*/ - - /*if(colorType == PNG_COLOR_TYPE_GRAY || colorType == PNG_COLOR_TYPE_GRAY_ALPHA){ - png_set_gray_to_rgb(pngPtr); - }*/ - - if(Width != NULL)*Width = width; - if(Height != NULL)*Height = height; - if(Type != NULL)*Type = type; - - if(Pixels == NULL){ - fclose(inputFile); - return true; - } - - png_read_update_info(pngPtr, infoPtr); - - // Allocate memory for rows - png_bytep* rowPointers = new png_bytep[height * sizeof(png_bytep)]; - for(int y = 0; y < height; y++) { - rowPointers[y] = new png_byte[png_get_rowbytes(pngPtr, infoPtr)]; - } - - // Fill rows with pixels - png_read_image(pngPtr, rowPointers); - - int stride = 0; - - if (type == imageType::GRAYSCALE_8){ - *Pixels = new uint8_t[width*height]; - stride = width; - - } else if(type == imageType::GRAYSCALE_ALPHA_8){ - *Pixels = new uint8_t[width*height*2]; - stride = width*2; - - } else if(type == imageType::GRAYSCALE_16){ - *Pixels = new uint8_t[width*height*2]; - stride = width*2; - - } else if(type == imageType::GRAYSCALE_ALPHA_16){ - *Pixels = new uint8_t[width*height*4]; - stride = width*4; - - } else if(type == imageType::RGB_888){ - *Pixels = new uint8_t[width*height*3]; - stride = width*3; - - } else if(type == imageType::RGB_ALPHA_8888){ - *Pixels = new uint8_t[width*height*4]; - stride = width*4; - - } else if(type == imageType::RGB_161616){ - *Pixels = new uint8_t[width*height*6]; - stride = width*6; - - } else if(type == imageType::RGB_ALPHA_16161616){ - *Pixels = new uint8_t[width*height*8]; - stride = width*8; - } - - for(int y = 0; y < height; y++) { - memcpy(&((*Pixels)[stride *y]), rowPointers[height -y -1], stride); - } - - delete[] header; - for(int y = 0; y < height; y++) { - delete[] rowPointers[y]; - } - delete[] rowPointers; - - fclose(inputFile); - - return true; -} - -///============================================================================= -bool ffw::savePNG(const std::string& Path, unsigned char* Pixels, int Width, int Height, ffw::imageType Type){ - return savePNG(utf8ToWstr(Path), Pixels, Width, Height, Type); -} - -///============================================================================= -bool ffw::savePNG(const std::wstring& Path, unsigned char* Pixels, int Width, int Height, ffw::imageType Type){ - if(Pixels == NULL)return false; - if(Width == 0 || Height == 0)return false; - if(!(Type == imageType::GRAYSCALE_8 || - Type == imageType::GRAYSCALE_16 || - Type == imageType::GRAYSCALE_ALPHA_8 || - Type == imageType::GRAYSCALE_ALPHA_16 || - Type == imageType::RGB_888 || - Type == imageType::RGB_ALPHA_8888 || - Type == imageType::RGB_161616 || - Type == imageType::RGB_ALPHA_16161616))return false; - - FILE *outputFile = _wfopen(Path.c_str(), L"wb"); - if(!outputFile){ - return false; - } - - png_structp pngPtr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - if (!pngPtr){ - fclose(outputFile); - return false; - } - - png_infop pngInfo = png_create_info_struct(pngPtr); - if (!pngInfo){ - fclose(outputFile); - return false; - } - - if (setjmp(png_jmpbuf(pngPtr))){ - fclose(outputFile); - return false; - } - - png_init_io(pngPtr, outputFile); - - int bitDepth = 0; - png_byte colorType = 0; - int stride = 0; - - - if (Type == ffw::imageType::GRAYSCALE_8){ - colorType = PNG_COLOR_TYPE_GRAY; - bitDepth = 8; - stride = Width; - - } else if(Type == ffw::imageType::GRAYSCALE_16){ - colorType = PNG_COLOR_TYPE_GRAY; - bitDepth = 16; - stride = Width*2; - - } else if(Type == ffw::imageType::GRAYSCALE_ALPHA_8){ - colorType = PNG_COLOR_TYPE_GRAY_ALPHA; - bitDepth = 8; - stride = Width*2; - - } else if(Type == ffw::imageType::GRAYSCALE_ALPHA_16){ - colorType = PNG_COLOR_TYPE_GRAY_ALPHA; - bitDepth = 16; - stride = Width*4; - - } else if(Type == ffw::imageType::RGB_888){ - colorType = PNG_COLOR_TYPE_RGB; - bitDepth = 8; - stride = Width*3; - - } else if(Type == ffw::imageType::RGB_ALPHA_8888){ - colorType = PNG_COLOR_TYPE_RGB_ALPHA; - bitDepth = 8; - stride = Width*4; - - } else if(Type == ffw::imageType::RGB_161616){ - colorType = PNG_COLOR_TYPE_RGB; - bitDepth = 16; - stride = Width*6; - - } else if(Type == ffw::imageType::RGB_ALPHA_16161616){ - colorType = PNG_COLOR_TYPE_RGB_ALPHA; - bitDepth = 16; - stride = Width*8; - } - - png_set_IHDR( - pngPtr, - pngInfo, - Width, Height, - bitDepth, - colorType, - PNG_INTERLACE_NONE, - PNG_COMPRESSION_TYPE_DEFAULT, - PNG_FILTER_TYPE_DEFAULT - ); - - png_write_info(pngPtr, pngInfo); - - //png_set_filler(pngPtr, 0, PNG_FILLER_AFTER); - - png_bytep* rowPointers = new png_bytep[Height]; - for(int y = 0; y < Height; y++){ - rowPointers[Height -y -1] = &Pixels[stride*y]; - } - - if(bitDepth == 16) - png_set_swap(pngPtr); - - png_write_image(pngPtr, rowPointers); - png_write_end(pngPtr, NULL); - - png_destroy_write_struct(&pngPtr, &pngInfo); - - delete[] rowPointers; - - fclose(outputFile); - - return true; -} diff --git a/third-party-libs/FragmentFramework/include/utilities/loadSavePng.h b/third-party-libs/FragmentFramework/include/utilities/loadSavePng.h deleted file mode 100644 index 8f08ccc..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/loadSavePng.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_LOAD_SAVE_PNG -#define FFW_LOAD_SAVE_PNG - -#include "../dll.h" -#include -#include "fileUtilities.h" - -/*! - @ingroup Utilities -*/ -namespace ffw{ - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API loadPNG(const std::string& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type); - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API savePNG(const std::string& Path, unsigned char* Pixels, int Width, int Height, imageType Type); - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API loadPNG(const std::wstring& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type); - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API savePNG(const std::wstring& Path, unsigned char* Pixels, int Width, int Height, imageType Type); -}; -#endif - - diff --git a/third-party-libs/FragmentFramework/include/utilities/loadSaveTga.cpp b/third-party-libs/FragmentFramework/include/utilities/loadSaveTga.cpp deleted file mode 100644 index fcc2f41..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/loadSaveTga.cpp +++ /dev/null @@ -1,271 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#include "loadSaveTga.h" -#include "../math/math.h" -#include "../math/stringMath.h" -#include "file.h" - -static uint8_t tgaFooter[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x52, 0x55, 0x45, 0x56, 0x49, 0x53, 0x49, 0x4F, 0x4E, 0x2D, 0x58, 0x46, 0x49, 0x4c, 0x45, 0x2E, 0x00}; - -///============================================================================= -bool ffw::loadTGA(const std::string& Path, unsigned char** Pixels, int* Width, int* Height, ffw::imageType* Type){ - return loadTGA(utf8ToWstr(Path), Pixels, Width, Height, Type); -} - -///============================================================================= -bool ffw::loadTGA(const std::wstring& Path, unsigned char** Pixels, int* Width, int* Height, ffw::imageType* Type){ - file input; - if(!input.open(Path, true, false, false)){ - return false; - } - - // Check if file is big enough to contain header - size_t size = input.getSize(); - if(size < 18)return false; - - uint8_t idLength; - uint8_t colorMapType; - uint8_t imageType; - uint16_t colorMapEntry; - uint16_t colorMapLength; - uint8_t colorMapSize; - uint16_t originX; - uint16_t originY; - uint16_t width; - uint16_t height; - uint8_t bitsPerPixel; - uint8_t imageDescriptor; - ffw::imageType type; - - // Read header - input.read(&idLength, sizeof(uint8_t)); - input.read(&colorMapType, sizeof(uint8_t)); - input.read(&imageType, sizeof(uint8_t)); - input.read(&colorMapEntry, sizeof(uint16_t)); - input.read(&colorMapLength, sizeof(uint16_t)); - input.read(&colorMapSize, sizeof(uint8_t)); - input.read(&originX, sizeof(uint16_t)); - input.read(&originY, sizeof(uint16_t)); - input.read(&width, sizeof(uint16_t)); - input.read(&height, sizeof(uint16_t)); - input.read(&bitsPerPixel, sizeof(uint8_t)); - input.read(&imageDescriptor, sizeof(uint8_t)); - - // Read extra id - if(idLength > 0){ - uint8_t* id = new uint8_t[idLength]; - input.read(&id, idLength*sizeof(uint8_t)); - delete[] id; - } - - // Check if there is no compression - if(colorMapType != 0)return false; - if(!(imageType == 2 || imageType == 3))return false; - - // Get number of channels - if(imageType == 3){ - type = ffw::imageType::GRAYSCALE_8; - - } else if(imageType == 2 && bitsPerPixel == 16 && imageDescriptor == 1){ - type = ffw::imageType::RGB_ALPHA_5551; - - } else if(imageType == 2 && bitsPerPixel == 24 && imageDescriptor == 0){ - type = ffw::imageType::RGB_888; - - } else if(imageType == 2 && bitsPerPixel == 32 && imageDescriptor == 8){ - type = ffw::imageType::RGB_ALPHA_8888; - - } else { - return false; - } - - // Check if file contains all pixels - if(size < 18 + size_t(width*height*(bitsPerPixel/8))){ - return false; - } - - if(Width != NULL)*Width = width; - if(Height != NULL)*Height = height; - if(Type != NULL)*Type = type; - - if(Pixels == NULL)return true; - - // Black and white, nothing to do - if(type == ffw::imageType::GRAYSCALE_8){ - *Pixels = new uint8_t[width*height]; - input.read(*Pixels, width*height); - - // RGBA_5155 to RGBA_5551 - } else if(type == ffw::imageType::RGB_ALPHA_5551){ - uint8_t* temp = new uint8_t[width*height*2]; - input.read(temp, width*height*2); - *Pixels = new uint8_t[width*height*2]; - // 16 bit BGR to 24bit RGB - //uint16_t* tempPtr = (uint16_t*)temp; - //for(int i = 0, p = 0; i < width*height; i ++, p += 3){ - - /*uint8_t red = (tempPtr[i] & 0x7C00) >> 10; - red = red << (8-5) | red >> (2*5-8); - - uint8_t green = (tempPtr[i] & 0x03E0) >> 5; - green = green << (8-5) | green >> (2*5-8); - - uint8_t blue = (tempPtr[i] & 0x001F); - blue = blue << (8-5) | blue >> (2*5-8); - - (*Pixels)[p+0] = red; - (*Pixels)[p+1] = green; - (*Pixels)[p+2] = blue;*/ - for(int i = 0; i < width*height*2; i+=2){ - (*Pixels)[i+0] = temp[i+1]; - (*Pixels)[i+1] = temp[i+0]; - } - delete[] temp; - - // BGR_888 to RGB_888 - } else if(type == ffw::imageType::RGB_888){ - uint8_t* temp = new uint8_t[width*height*3]; - input.read(temp, width*height*3); - *Pixels = new uint8_t[width*height*3]; - for(int i = 0; i < width*height*3; i += 3){ - (*Pixels)[i+0] = temp[i+2]; - (*Pixels)[i+1] = temp[i+1]; - (*Pixels)[i+2] = temp[i+0]; - } - delete[] temp; - - // BGRA_8888 to RGBA_8888 - } else if(type == ffw::imageType::RGB_ALPHA_8888){ - uint8_t* temp = new uint8_t[width*height*4]; - input.read(temp, width*height*4); - *Pixels = new uint8_t[width*height*4]; - for(int i = 0; i < width*height*4; i += 4){ - (*Pixels)[i+0] = temp[i+2]; - (*Pixels)[i+1] = temp[i+1]; - (*Pixels)[i+2] = temp[i+0]; - (*Pixels)[i+3] = temp[i+3]; - } - delete[] temp; - } - - return true; -} - -///============================================================================= -bool ffw::saveTGA(const std::string& Path, unsigned char* Pixels, int Width, int Height, imageType Type){ - return saveTGA(utf8ToWstr(Path), Pixels, Width, Height, Type); -} - -///============================================================================= -bool ffw::saveTGA(const std::wstring& Path, unsigned char* Pixels, int Width, int Height, imageType Type){ - if(Pixels == NULL)return false; - if(Width == 0 || Height == 0)return false; - - if(!(Type == imageType::GRAYSCALE_8 || - Type == imageType::RGB_ALPHA_5551 || - Type == imageType::RGB_888 || - Type == imageType::RGB_ALPHA_8888))return false; - - if(Pixels == NULL)return false; - - file output; - if(!output.open(Path, true,true, true)){ - return false; - } - - uint8_t idLength = 0; - uint8_t colorMapType = 0; - uint8_t imageType = 3; - uint16_t colorMapEntry = 0; - uint16_t colorMapLength = 0; - uint8_t colorMapSize = 0; - uint16_t originX = 0; - uint16_t originY = 0; - uint16_t width = Width; - uint16_t height = Height; - uint8_t bitsPerPixel = 32; - uint8_t imageDescriptor = 0; - - if(Type == ffw::imageType::GRAYSCALE_8){ - imageType = 3; - bitsPerPixel = 8; - imageDescriptor = 0; - - } else if(Type == ffw::imageType::RGB_ALPHA_5551){ - imageType = 2; - bitsPerPixel = 16; - imageDescriptor = 1; - - } else if(Type == ffw::imageType::RGB_888){ - imageType = 2; - bitsPerPixel = 24; - imageDescriptor = 0; - - } else if(Type == ffw::imageType::RGB_ALPHA_8888){ - imageType = 2; - bitsPerPixel = 32; - imageDescriptor = 8; - } - - // Read header - output.write(&idLength, sizeof(uint8_t)); - output.write(&colorMapType, sizeof(uint8_t)); - output.write(&imageType, sizeof(uint8_t)); - output.write(&colorMapEntry, sizeof(uint16_t)); - output.write(&colorMapLength, sizeof(uint16_t)); - output.write(&colorMapSize, sizeof(uint8_t)); - output.write(&originX, sizeof(uint16_t)); - output.write(&originY, sizeof(uint16_t)); - output.write(&width, sizeof(uint16_t)); - output.write(&height, sizeof(uint16_t)); - output.write(&bitsPerPixel, sizeof(uint8_t)); - output.write(&imageDescriptor, sizeof(uint8_t)); - - // GRAYSCALE_8 - if(Type == ffw::imageType::GRAYSCALE_8){ - //temp = Pixels; - output.write(Pixels, width*height); - - // RGBA_5551 to BGRA_5515 - } else if(Type == ffw::imageType::RGB_ALPHA_5551){ - uint8_t* temp = new uint8_t[width*height*2]; - for(int i = 0; i < width*height*2; i += 2){ - temp[i+0] = Pixels[i+1]; - temp[i+1] = Pixels[i+0]; - } - output.write(temp, width*height*2); - delete[] temp; - - // RGB_888 to BGR_888 - } else if(Type == ffw::imageType::RGB_888){ - uint8_t* temp = new uint8_t[width*height*3]; - for(int i = 0; i < width*height*3; i += 3){ - temp[i+0] = Pixels[i+2]; - temp[i+1] = Pixels[i+1]; - temp[i+2] = Pixels[i+0]; - } - output.write(temp, width*height*3); - delete[] temp; - - // RGBA_8888 to BGRA_8888 - } else if(Type == ffw::imageType::RGB_ALPHA_8888){ - uint8_t* temp = new uint8_t[width*height*4]; - for(int i = 0; i < width*height*4; i += 4){ - temp[i+0] = Pixels[i+2]; - temp[i+1] = Pixels[i+1]; - temp[i+2] = Pixels[i+0]; - temp[i+3] = Pixels[i+3]; - } - output.write(temp, width*height*4); - delete[] temp; - - } - - output.write(&tgaFooter[0], sizeof(tgaFooter)); - - return true; -} diff --git a/third-party-libs/FragmentFramework/include/utilities/loadSaveTga.h b/third-party-libs/FragmentFramework/include/utilities/loadSaveTga.h deleted file mode 100644 index 5bc5398..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/loadSaveTga.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_LOAD_SAVE_TGA -#define FFW_LOAD_SAVE_TGA - -#include "../dll.h" -#include -#include "fileUtilities.h" - -/*! - @ingroup Utilities -*/ -namespace ffw{ - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API loadTGA(const std::string& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type); - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API saveTGA(const std::string& Path, unsigned char* Pixels, int Width, int Height, imageType Type); - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API loadTGA(const std::wstring& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type); - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API saveTGA(const std::wstring& Path, unsigned char* Pixels, int Width, int Height, imageType Type); -}; -#endif - diff --git a/third-party-libs/FragmentFramework/include/utilities/loadSaveTiff.cpp b/third-party-libs/FragmentFramework/include/utilities/loadSaveTiff.cpp deleted file mode 100644 index 59aef6f..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/loadSaveTiff.cpp +++ /dev/null @@ -1,295 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#include "loadSaveTiff.h" -#include -#include "../math/math.h" -#include "../math/stringMath.h" -#include "file.h" - -///============================================================================= -bool ffw::loadTIFF(const std::string& Path, unsigned char** Pixels, int* Width, int* Height, ffw::imageType* Type){ - return loadTIFF(utf8ToWstr(Path), Pixels, Width, Height, Type); -} - -///============================================================================= -bool ffw::loadTIFF(const std::wstring& Path, unsigned char** Pixels, int* Width, int* Height, ffw::imageType* Type){ - TIFF* tif = TIFFOpenW(Path.c_str(), "r"); - if(tif == NULL)return false; - - uint32 imagelength; - size_t scanline; - tdata_t buf; - uint32_t row; - uint32_t width; - uint32_t height; - uint16_t bitsPerPixel; - uint16_t compression; - uint16_t dataType; - imageType type; - - uint16_t photometric; - uint16_t samplesPerPixel; - - TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &imagelength); - TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &width); - TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bitsPerPixel); - TIFFGetField(tif, TIFFTAG_COMPRESSION, &compression); - TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric); - TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &samplesPerPixel); - TIFFGetField(tif, TIFFTAG_DATATYPE, &dataType); - - std::cout << "photometric: " << photometric << std::endl; - std::cout << "samplesPerPixel: " << samplesPerPixel << std::endl; - std::cout << "dataType: " << dataType << std::endl; - - scanline = TIFFScanlineSize(tif); - height = imagelength; - - if(bitsPerPixel == 8){ - if(samplesPerPixel == 3 && scanline/3 == width){ - type = imageType::RGB_888; - } else if(samplesPerPixel == 4 && scanline/4 == width){ - type = imageType::RGB_ALPHA_8888; - } else if(samplesPerPixel == 2 && scanline/2 == width){ - type = imageType::GRAYSCALE_ALPHA_8; - } else if(samplesPerPixel == 1 && scanline == width){ - type = imageType::GRAYSCALE_8; - } else { - TIFFClose(tif); - return false; - } - } else if(bitsPerPixel == 16){ - if(samplesPerPixel == 3 && scanline/6 == width){ - type = imageType::RGB_161616; - } else if(samplesPerPixel == 4 && scanline/8 == width){ - type = imageType::RGB_ALPHA_16161616; - } else if(samplesPerPixel == 2 && scanline/8 == width){ - type = imageType::GRAYSCALE_ALPHA_16; - } else if(samplesPerPixel == 1 && scanline/2 == width){ - type = imageType::GRAYSCALE_16; - } else { - TIFFClose(tif); - return false; - } - } else if(bitsPerPixel == 32){ - if(samplesPerPixel == 3 && scanline/12 == width){ - type = imageType::RGB_323232; - } else if(samplesPerPixel == 4 && scanline/16 == width){ - type = imageType::RGB_ALPHA_32323232; - } else if(samplesPerPixel == 2 && scanline/8 == width){ - type = imageType::GRAYSCALE_ALPHA_32; - } else if(samplesPerPixel == 1 && scanline/4 == width){ - type = imageType::GRAYSCALE_32; - } else { - TIFFClose(tif); - return false; - } - } else { - TIFFClose(tif); - return false; - } - - if(Width != NULL)*Width = width; - if(Height != NULL)*Height = height; - if(Type != NULL)*Type = type; - - if(Pixels == NULL)return true; - - if (type == imageType::GRAYSCALE_8) - *Pixels = new uint8_t[width*height]; - else if(type == imageType::GRAYSCALE_ALPHA_8) - *Pixels = new uint8_t[width*height*2]; - else if(type == imageType::GRAYSCALE_16) - *Pixels = new uint8_t[width*height*2]; - else if(type == imageType::GRAYSCALE_ALPHA_16) - *Pixels = new uint8_t[width*height*4]; - else if(type == imageType::GRAYSCALE_32) - *Pixels = new uint8_t[width*height*4]; - else if(type == imageType::GRAYSCALE_ALPHA_32) - *Pixels = new uint8_t[width*height*8]; - else if(type == imageType::RGB_888) - *Pixels = new uint8_t[width*height*3]; - else if(type == imageType::RGB_ALPHA_8888) - *Pixels = new uint8_t[width*height*4]; - else if(type == imageType::RGB_161616) - *Pixels = new uint8_t[width*height*6]; - else if(type == imageType::RGB_ALPHA_16161616) - *Pixels = new uint8_t[width*height*8]; - else if(type == imageType::RGB_323232) - *Pixels = new uint8_t[width*height*12]; - else if(type == imageType::RGB_ALPHA_32323232) - *Pixels = new uint8_t[width*height*16]; - - buf = _TIFFmalloc(scanline); - for (row = 0; row < imagelength; row++){ - TIFFReadScanline(tif, &(*Pixels)[row*scanline], imagelength -row -1); - } - _TIFFfree(buf); - TIFFClose(tif); - - return true; -} - -///============================================================================= -bool ffw::saveTIFF(const std::string& Path, unsigned char* Pixels, int Width, int Height, ffw::imageType Type){ - return saveTIFF(utf8ToWstr(Path), Pixels, Width, Height, Type); -} - -///============================================================================= -bool ffw::saveTIFF(const std::wstring& Path, unsigned char* Pixels, int Width, int Height, ffw::imageType Type){ - if(Pixels == NULL)return false; - if(Width == 0 || Height == 0)return false; - - if(!(Type == imageType::GRAYSCALE_8 || - Type == imageType::GRAYSCALE_16 || - Type == imageType::GRAYSCALE_32 || - Type == imageType::GRAYSCALE_ALPHA_8 || - Type == imageType::GRAYSCALE_ALPHA_16 || - Type == imageType::GRAYSCALE_ALPHA_32 || - Type == imageType::RGB_888 || - Type == imageType::RGB_161616 || - Type == imageType::RGB_323232 || - Type == imageType::RGB_ALPHA_8888 || - Type == imageType::RGB_ALPHA_16161616 || - Type == imageType::RGB_ALPHA_32323232))return false; - - TIFF* tif = TIFFOpenW(Path.c_str(), "w"); - if(tif == NULL)return false; - - uint16_t bitsPerPixel = 0; - uint16_t samplesPerPixel = 0; - uint32_t scanline = 0; - uint16_t photometric = 0; - uint16_t dataType = 0; - - if(Type == imageType::GRAYSCALE_8){ - bitsPerPixel = 8; - samplesPerPixel = 1; - scanline = Width; - photometric = 1; - dataType = 0; - } else if(Type == imageType::GRAYSCALE_16){ - bitsPerPixel = 16; - samplesPerPixel = 1; - scanline = Width*2; - photometric = 1; - dataType = 0; - } else if(Type == imageType::GRAYSCALE_32){ - bitsPerPixel = 32; - samplesPerPixel = 1; - scanline = Width*4; - photometric = 1; - dataType = 3; - } else if(Type == imageType::GRAYSCALE_ALPHA_8){ - bitsPerPixel = 8; - samplesPerPixel = 2; - scanline = Width*2; - photometric = 1; - dataType = 0; - } else if(Type == imageType::GRAYSCALE_ALPHA_16){ - bitsPerPixel = 16; - samplesPerPixel = 2; - scanline = Width*4; - photometric = 1; - dataType = 0; - } else if(Type == imageType::GRAYSCALE_ALPHA_32){ - bitsPerPixel = 32; - samplesPerPixel = 2; - scanline = Width*8; - photometric = 1; - dataType = 3; - } else if(Type == imageType::RGB_888){ - bitsPerPixel = 8; - samplesPerPixel = 3; - scanline = Width*3; - photometric = 2; - dataType = 0; - } else if(Type == imageType::RGB_161616){ - bitsPerPixel = 16; - samplesPerPixel = 3; - scanline = Width*6; - photometric = 2; - dataType = 0; - } else if(Type == imageType::RGB_323232){ - bitsPerPixel = 32; - samplesPerPixel = 3; - scanline = Width*12; - photometric = 2; - dataType = 3; - } else if(Type == imageType::RGB_ALPHA_8888){ - bitsPerPixel = 8; - samplesPerPixel = 4; - scanline = Width*4; - photometric = 2; - dataType = 0; - } else if(Type == imageType::RGB_ALPHA_16161616){ - bitsPerPixel = 16; - samplesPerPixel = 4; - scanline = Width*8; - photometric = 2; - dataType = 0; - } else if(Type == imageType::RGB_ALPHA_32323232){ - bitsPerPixel = 32; - samplesPerPixel = 4; - scanline = Width*16; - photometric = 2; - dataType = 3; - } - - TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, Width); - TIFFSetField(tif, TIFFTAG_IMAGELENGTH, Height); - TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bitsPerPixel); - TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, samplesPerPixel); - TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); - TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); - TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, photometric); - TIFFSetField(tif, TIFFTAG_DATATYPE, dataType); - - uint32 rowsperstrip = TIFFDefaultStripSize(tif, -1); - - TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip); - TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_PACKBITS); - - // Start CCITTFAX3 setting - - //uint32 group3options = GROUP3OPT_FILLBITS+GROUP3OPT_2DENCODING; - //TIFFSetField(tif, TIFFTAG_GROUP3OPTIONS, group3options); - //TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_CLASSF); - //TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); - //TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, -1L); - - - // End CCITTFAX3 setting - - //TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK); - - //TIFFSetField(tif, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB); - //TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); - - TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); - TIFFSetField(tif, TIFFTAG_XRESOLUTION, 100.0); - TIFFSetField(tif, TIFFTAG_YRESOLUTION, 100.0); - - //char page_number[20]; - //sprintf(page_number, "Page %d", 1); - - //TIFFSetField(tif, TIFFTAG_SUBFILETYPE, FILETYPE_PAGE); - //TIFFSetField(tif, TIFFTAG_PAGENUMBER, 1, 1); - //TIFFSetField(tif, TIFFTAG_PAGENAME, page_number); - - // Write pixels - for(int row = 0; row < Height; row++){ - if (TIFFWriteScanline(tif, &Pixels[(Height -row -1)*scanline], row, 0) == -1){ - TIFFClose(tif); - return true; - } - } - - // Close the file - TIFFClose(tif); - return true; -} diff --git a/third-party-libs/FragmentFramework/include/utilities/loadSaveTiff.h b/third-party-libs/FragmentFramework/include/utilities/loadSaveTiff.h deleted file mode 100644 index 2e0696f..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/loadSaveTiff.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_LOAD_SAVE_TIFF -#define FFW_LOAD_SAVE_TIFF - -#include "../dll.h" -#include -#include "fileUtilities.h" - -/*! - @ingroup Utilities -*/ -namespace ffw{ - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API loadTIFF(const std::wstring& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type); - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API saveTIFF(const std::wstring& Path, unsigned char* Pixels, int Width, int Height, imageType Type); - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API loadTIFF(const std::string& Path, unsigned char** Pixels, int* Width, int* Height, imageType* Type); - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API saveTIFF(const std::string& Path, unsigned char* Pixels, int Width, int Height, imageType Type); -}; -#endif - - diff --git a/third-party-libs/FragmentFramework/include/utilities/loadSaveTxt.cpp b/third-party-libs/FragmentFramework/include/utilities/loadSaveTxt.cpp deleted file mode 100644 index bc534f4..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/loadSaveTxt.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#include "loadSaveTxt.h" -#include "file.h" -#include "../math/math.h" -#include "../math/stringMath.h" - -///============================================================================= -bool ffw::loadTXT(const std::string& Path, std::string* Data){ - return loadTXT(utf8ToWstr(Path), Data); -} - -///============================================================================= -bool ffw::loadTXT(const std::wstring& Path, std::string* Data){ - if(Data == NULL)return false; - - ffw::file input; - if(!input.open(Path, false, false, false))return false; - - Data->clear(); - while(!input.eof()){ - std::string temp; - input.readLine(&temp); - (*Data) += temp + "\n"; - } - return true; - - /*size_t size = input.getSize(); - Data->resize(size, ' '); - input.read(&(*Data)[0], size); - return true;*/ - - /*std::ifstream file; - file.open(Path.c_str(), std::ifstream::in); - if(!file){ - return false; - } - - Data->clear(); - std::string temp; - while(std::getline(file, temp)){ - (*Data) += temp + "\n"; - } - - file.close(); - return true;*/ -} - -///============================================================================= -bool ffw::saveTXT(const std::string& Path, const std::string& Data){ - return saveTXT(utf8ToWstr(Path), Data); -} - -///============================================================================= -bool ffw::saveTXT(const std::wstring& Path, const std::string& Data){ - ffw::file output; - if(!output.open(Path, false, true, true))return false; - - output.write((void*)&Data[0], Data.size()); - return true; - - /*std::ofstream file; - file.open(Path.c_str(), std::ofstream::out | std::ofstream::trunc); - if(!file){ - return false; - } - - file << Data; - - file.close(); - return true;*/ -} - -///============================================================================= -bool ffw::loadTXT(const std::string& Path, std::vector* Data){ - return loadTXT(utf8ToWstr(Path), Data); -} - -///============================================================================= -bool ffw::loadTXT(const std::wstring& Path, std::vector* Data){ - if(Data == NULL)return false; - - ffw::file input; - if(!input.open(Path, false, false, false))return false; - - size_t lines = input.countLines(); - Data->resize(lines); - for(size_t i = 0; i < lines; i++){ - input.readLine(&(*Data)[i]); - } - - return true; - - - /*if(Data == NULL)return false; - - std::ifstream file; - file.open(Path.c_str(), std::ifstream::in); - if(!file){ - return false; - } - - Data->clear(); - std::string temp; - while(std::getline(file, temp)){ - Data->push_back(temp); - } - - file.close(); - return true;*/ -} - -///============================================================================= -bool ffw::saveTXT(const std::string& Path, const std::vector& Data){ - return saveTXT(utf8ToWstr(Path), Data); -} - -///============================================================================= -bool ffw::saveTXT(const std::wstring& Path, const std::vector& Data){ - ffw::file output; - if(!output.open(Path, false, true, true))return false; - - for(const auto& line : Data){ - output.writeLine(line); - } - return true; - - /*std::ofstream file; - file.open(Path.c_str(), std::ofstream::out | std::ofstream::trunc); - if(!file){ - return false; - } - - for(size_t i = 0; i < Data.size(); i++){ - file << Data[i] + "\n"; - } - file.close(); - return true;*/ -} - -/*///============================================================================= -bool ffw::loadTXTutf8(const std::wstring& Path, std::wstring* Data){ - if(Data == NULL)return false; - - FILE* file = _wfopen(&Path[0], L"rtS, ccs=UTF-8"); - - if(file == NULL){ - //logger().error() << "[File loader] " << Path << " failed to open!"; - return false; - } - - struct _stat fileinfo; - _wstat(&Path[0], &fileinfo); - size_t size = fileinfo.st_size; - - if(size > 0){ - Data->resize(size); - size_t wchars_read = fread(&(Data->front()), sizeof(wchar_t), size, file); - Data->resize(wchars_read); - Data->shrink_to_fit(); - } - - fclose(file); - return true; -} - -///============================================================================= -bool ffw::saveTXTutf8(const std::wstring& Path, const std::wstring& Data){ - FILE* file = _wfopen(&Path[0], L"wtS, ccs=UTF-8"); - - if(file == NULL){ - return false; - } - - fwrite(&Data[0], sizeof(wchar_t), Data.size(), file); - - fclose(file); - return true; -}*/ diff --git a/third-party-libs/FragmentFramework/include/utilities/loadSaveWav.cpp b/third-party-libs/FragmentFramework/include/utilities/loadSaveWav.cpp deleted file mode 100644 index 5c3d8e6..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/loadSaveWav.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#include "loadSaveWav.h" -#include "file.h" -#include "../math/stringMath.h" - -///============================================================================= -bool ffw::loadWAV(const std::string& Path, unsigned char** Data, int* BitsPerSample, size_t* Size, int* ByteRate, int* SampleRate, int* NumChannels){ - return loadWAV(utf8ToWstr(Path), Data, BitsPerSample, Size, ByteRate, SampleRate, NumChannels); -} - -///============================================================================= -bool ffw::loadWAV(const std::wstring& Path, unsigned char** Data, int* BitsPerSample, size_t* Size, int* ByteRate, int* SampleRate, int* NumChannels){ - if(Data == NULL)return false; - - file input; - if(!input.open(Path, true, false, false)){ - return false; - } - - // Check if file is RIFF - char chunkID[4]; - input.read( reinterpret_cast (&chunkID[0]), sizeof(char)); - input.read( reinterpret_cast (&chunkID[1]), sizeof(char)); - input.read( reinterpret_cast (&chunkID[2]), sizeof(char)); - input.read( reinterpret_cast (&chunkID[3]), sizeof(char)); - if( !(chunkID[0] == 'R' && chunkID[1] == 'I' && chunkID[2] == 'F' && chunkID[3] == 'F') ){ - //logger().error() << "[File loader] " << Path << " Can not be opened as audio! File is not RIFF!"; - input.close(); - return false; - } - - // Get chunk size - unsigned int chunkSize; - input.read( reinterpret_cast (&chunkSize), sizeof(unsigned int)); - - // Check if file is WAVE - char format[4]; - input.read( reinterpret_cast (&format[0]), sizeof(char)); - input.read( reinterpret_cast (&format[1]), sizeof(char)); - input.read( reinterpret_cast (&format[2]), sizeof(char)); - input.read( reinterpret_cast (&format[3]), sizeof(char)); - if( !(format[0] == 'W' && format[1] == 'A' && format[2] == 'V' && format[3] == 'E') ){ - //logger().error() << "[File loader] " << Path << " Can not be opened as audio! File is RIFF but not WAVE!"; - input.close(); - return false; - } - - // Find FMT sub-chunk - bool foundFMT = false; - while(!foundFMT && !input.eof()){ - char subchunk1ID[4]; - input.read( reinterpret_cast (&subchunk1ID[0]), sizeof(char)); - if(subchunk1ID[0] == 'f'){ - input.read( reinterpret_cast (&subchunk1ID[1]), sizeof(char)); - input.read( reinterpret_cast (&subchunk1ID[2]), sizeof(char)); - input.read( reinterpret_cast (&subchunk1ID[3]), sizeof(char)); - if(subchunk1ID[1] == 'm' && subchunk1ID[2] == 't' && subchunk1ID[3] == ' ')foundFMT = true; - } - } - - if(!foundFMT){ - //logger().error() << "[File loader] " << Path << " Can not find FMT sub chunk! File might be corrupted!"; - input.close(); - return false; - } - - // Get sub chunk data - unsigned int subChunk1Size = 0; - unsigned short audioFormat = 0; - unsigned short numChannels = 0; - unsigned int sampleRate = 0; - unsigned int byteRate = 0; - unsigned short blockAlign = 0; - unsigned short bitsPerSample = 0; - - input.read( reinterpret_cast (&subChunk1Size), sizeof(unsigned int)); - input.read( reinterpret_cast (&audioFormat), sizeof(unsigned short)); - input.read( reinterpret_cast (&numChannels), sizeof(unsigned short)); - input.read( reinterpret_cast (&sampleRate), sizeof(unsigned int)); - input.read( reinterpret_cast (&byteRate), sizeof(unsigned int)); - input.read( reinterpret_cast (&blockAlign), sizeof(unsigned short)); - input.read( reinterpret_cast (&bitsPerSample), sizeof(unsigned short)); - - // Find data sub-chunk - bool foundData = false; - while(!foundData && !input.eof()){ - char subchunk1ID[4]; - input.read( reinterpret_cast (&subchunk1ID[0]), sizeof(char)); - if(subchunk1ID[0] == 'd'){ - input.read( reinterpret_cast (&subchunk1ID[1]), sizeof(char)); - input.read( reinterpret_cast (&subchunk1ID[2]), sizeof(char)); - input.read( reinterpret_cast (&subchunk1ID[3]), sizeof(char)); - if(subchunk1ID[1] == 'a' && subchunk1ID[2] == 't' && subchunk1ID[3] == 'a')foundData = true; - } - } - - if(!foundData){ - //logger().error() << "[File loader] " << Path << " Can not find data sub chunk! File might be corrupted!"; - input.close(); - return false; - } - - // Get size of data - unsigned int subChunk2Size = 0; - input.read( reinterpret_cast (&subChunk2Size), sizeof(unsigned int)); - - if(Data != NULL){ - // Read data - *Data = new unsigned char[subChunk2Size]; - input.read( reinterpret_cast (*Data), subChunk2Size); - - if(Size != NULL)*Size = subChunk2Size; - } - - if(BitsPerSample != NULL)*BitsPerSample = bitsPerSample; - if(ByteRate != NULL)*ByteRate = byteRate; - if(SampleRate != NULL)*SampleRate = sampleRate; - if(NumChannels != NULL)*NumChannels = numChannels; - - input.close(); - //logger().debug() << "[File loader] " << Path << " successfully loaded as WAV sound!"; - return true; -} - -///============================================================================= -bool ffw::saveWAV(const std::string& Path, unsigned char* Data, int BitsPerSample, size_t Size, int ByteRate, int SampleRate, int NumChannels){ - return saveWAV(utf8ToWstr(Path), Data, BitsPerSample, Size, ByteRate, SampleRate, NumChannels); -} - -///============================================================================= -bool ffw::saveWAV(const std::wstring& Path, unsigned char* Data, int BitsPerSample, size_t Size, int ByteRate, int SampleRate, int NumChannels){ - if(Data == NULL)return false; - if(BitsPerSample == 0 || Size == 0 || ByteRate == 0 || SampleRate == 0 || NumChannels == 0)return false; - - file output; - if(!output.open(Path, true, true, true)){ - return false; - } - - // Wrtie header ID - char chunkID[4] = {'R', 'I', 'F', 'F'}; - output.write(chunkID, sizeof(chunkID)); - - unsigned int subChunk1Size = 16; // PCM - unsigned int subChunk2Size = Size; - unsigned int chunk1Size = 4 + (8 + subChunk1Size) + (8 + subChunk2Size); - output.write( reinterpret_cast (&chunk1Size), sizeof(unsigned int) ); - - char format[4] = {'W', 'A', 'V', 'E'}; - output.write(format, sizeof(format)); - - // Wrtie FMT sub-chunk - char subchunk1ID[4] = {'f', 'm', 't', ' '}; - output.write(subchunk1ID, sizeof(subchunk1ID)); - - output.write( reinterpret_cast (&subChunk1Size), sizeof(unsigned int) ); - - unsigned short audioFormat = 0; - if(BitsPerSample == 16) audioFormat = 1; - else if(BitsPerSample == 32) audioFormat = 3; - unsigned short blockAlign = NumChannels * BitsPerSample / 8; - - output.write( reinterpret_cast (&audioFormat), sizeof(unsigned short) ); - output.write( reinterpret_cast (&NumChannels), sizeof(unsigned short) ); - output.write( reinterpret_cast (&SampleRate), sizeof(unsigned int) ); - output.write( reinterpret_cast (&ByteRate), sizeof(unsigned int) ); - output.write( reinterpret_cast (&blockAlign), sizeof(unsigned short) ); - output.write( reinterpret_cast (&BitsPerSample), sizeof(unsigned short) ); - - // Wrtie chunk ID - char subchunk2ID[4] = {'d', 'a', 't', 'a'}; - output.write(subchunk2ID, sizeof(subchunk2ID)); - // Wrtie size of data - output.write( reinterpret_cast (&subChunk2Size), sizeof(unsigned int) ); - // Write data - output.write( reinterpret_cast (Data), Size ); - - output.close(); - return true; -} diff --git a/third-party-libs/FragmentFramework/include/utilities/loadSaveWav.h b/third-party-libs/FragmentFramework/include/utilities/loadSaveWav.h deleted file mode 100644 index eec0ca0..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/loadSaveWav.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_LOAD_SAVE_WAV -#define FFW_LOAD_SAVE_WAV - -#include "../dll.h" -#include - -/*! - @ingroup Utilities -*/ -namespace ffw{ - /*! - @memberof ffw - @ingroup Utilities - - @brief Loads WAV file - - @details Loads audio data from WAV file. RIFF formal only. - - @param [in] Path Path to file - @param [out] Data Where to store buffer - @param [out] BitsPerSample Where to store bits per sample - @param [out] Size Where to store total buffer size - @param [out] ByteRate Where to store byte rate - @param [out] SampleRate Where to store sample rate (frequency) - @param [out] NumChannels Where to store number of channels - - @return True on success - - @see saveWAV() - - @code - // Example for loading WAV file - unsigned char* audioData; - int bitsPerSample; - size_t audioBufferSize; - int audioByteRate; - int audioSampleRate; - int audioChannels; - bool result = ffw::loadWAV("data/myaudiofile.wav", &audioData, &bitsPerSample, - &audioBufferSize, &audioByteRate &audioSampleRate, &audioChannels); - if(result){ - // Success - // Use audio data here, upload it into sound buffer or do anything you want - // After you are done delete the data - delete[] audioData; - } else { - // Loading audio file failed - } - @endcode - */ - bool FFW_API loadWAV(const std::string& Path, unsigned char** Data, int* BitsPerSample, size_t* Size, int* ByteRate, int* SampleRate, int* NumChannels); - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API saveWAV(const std::string& Path, unsigned char* Data, int BitsPerSample, size_t Size, int ByteRate, int SampleRate, int NumChannels); - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API loadWAV(const std::wstring& Path, unsigned char** Data, int* BitsPerSample, size_t* Size, int* ByteRate, int* SampleRate, int* NumChannels); - /*! - @memberof ffw - @ingroup Utilities - */ - bool FFW_API saveWAV(const std::wstring& Path, unsigned char* Data, int BitsPerSample, size_t Size, int ByteRate, int SampleRate, int NumChannels); -}; - -#endif diff --git a/third-party-libs/FragmentFramework/include/utilities/loadSaveXml.cpp b/third-party-libs/FragmentFramework/include/utilities/loadSaveXml.cpp deleted file mode 100644 index 9f2822b..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/loadSaveXml.cpp +++ /dev/null @@ -1,548 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#include "loadSaveXml.h" - -#include - -static void convertXML(tinyxml2::XMLElement* XML, ffw::var* Output); -static void insertToObject(tinyxml2::XMLElement* root, ffw::var* Output); -static void insertToArray(tinyxml2::XMLElement* root, ffw::var* Output); - -///============================================================================= -static bool checkIfInt(const std::string& Str){ - for(const auto& chr : Str){ - if(chr == 10 || chr == 13 || chr == 32 || chr == 9)continue; - if(!((chr >= '0' && chr <= '9') || chr == '-')){ - return false; - } - } - return true; -} - -///============================================================================= -static bool checkIfFloat(const std::string& Str){ - for(const auto& chr : Str){ - if(chr == 10 || chr == 13 || chr == 32 || chr == 9)continue; - if(!((chr >= '0' && chr <= '9') || chr == '-' || chr == '+' || chr == '.' || chr == 'e' || chr == 'E')){ - return false; - } - } - return true; -} - -///============================================================================= -static bool checkIfBool(const std::string& Str, bool* Bool){ - if(Str.size() == 4 && (Str.find("true") == 0 || Str.find("TRUE") == 0)){ - *Bool = true; - return true; - } else if (Str.size() == 5 && (Str.find("false") == 0 || Str.find("FALSE") == 0)){ - *Bool = false; - return true; - } - return false; -} - -///============================================================================= -static ffw::var parseVariable(const std::string& Str){ - ffw::var variable; - bool test; - if(checkIfInt(Str)){ - variable = ffw::stringToVal(Str); - return variable; - } else if(checkIfFloat(Str)){ - variable = ffw::stringToVal(Str); - return variable; - } else if(checkIfBool(Str, &test)){ - variable = test; - return variable; - } - variable = Str; - return variable; -} - -///============================================================================= -static void insertToObject(tinyxml2::XMLElement* root, ffw::var* Output){ - if(root->FirstChild() != NULL){ - // Parent does have children - if(root->GetText() != NULL){ - // Children is a simple text - const tinyxml2::XMLAttribute* attributePtr = root->FirstAttribute(); - if(attributePtr == NULL){ - Output->getAsObject().insert(std::make_pair(root->Name(), parseVariable(root->GetText()))); - } else { - auto result = Output->getAsObject().insert(std::make_pair(root->Name(), ffw::varObject())); - while(attributePtr != NULL){ - result.first->second.getAsObject().insert(std::pair("@" + std::string(attributePtr->Name()), parseVariable(attributePtr->Value()))); - attributePtr = attributePtr->Next(); - } - result.first->second.getAsObject().insert(std::pair("content", parseVariable(root->GetText()))); - } - - } else { - // Children has more elements - const tinyxml2::XMLAttribute* attributePtr = root->FirstAttribute(); - if(attributePtr == NULL){ - auto result = Output->getAsObject().insert(std::make_pair(root->Name(), ffw::varObject())); - convertXML(root->FirstChildElement(), &(result.first->second)); - - } else { - auto result = Output->getAsObject().insert(std::make_pair(root->Name(), ffw::varObject())); - while(attributePtr != NULL){ - result.first->second.getAsObject().insert(std::pair("@" + std::string(attributePtr->Name()), parseVariable(attributePtr->Value()))); - attributePtr = attributePtr->Next(); - } - result = result.first->second.getAsObject().insert(std::make_pair("content", ffw::varObject())); - convertXML(root->FirstChildElement(), &(result.first->second)); - } - } - } else { - // Parent does not have children - const tinyxml2::XMLAttribute* attributePtr = root->FirstAttribute(); - if(attributePtr == NULL){ - Output->getAsObject().insert(std::make_pair(root->Name(), "")); - } else { - auto result = Output->getAsObject().insert(std::make_pair(root->Name(), ffw::varObject())); - while(attributePtr != NULL){ - result.first->second.getAsObject().insert(std::pair("@" + std::string(attributePtr->Name()), parseVariable(attributePtr->Value()))); - attributePtr = attributePtr->Next(); - } - } - } -} - -///============================================================================= -static void insertToArray(tinyxml2::XMLElement* root, ffw::var* Output){ - if(root->FirstChild() != NULL){ - // Parent does have children - if(root->GetText() != NULL){ - // Children is a simple text - const tinyxml2::XMLAttribute* attributePtr = root->FirstAttribute(); - if(attributePtr == NULL){ - Output->getAsArray().push_back(parseVariable(root->GetText())); - } else { - Output->getAsArray().push_back(ffw::varObject()); - auto result = &(Output->getAsArray().at(Output->getAsArray().size()-1)); - while(attributePtr != NULL){ - result->getAsObject().insert(std::pair("@" + std::string(attributePtr->Name()), parseVariable(attributePtr->Value()))); - attributePtr = attributePtr->Next(); - } - result->getAsObject().insert(std::pair("content", parseVariable(root->GetText()))); - } - } else { - // Children has more elements - const tinyxml2::XMLAttribute* attributePtr = root->FirstAttribute(); - if(attributePtr == NULL){ - Output->getAsArray().push_back(ffw::varObject()); - convertXML(root->FirstChildElement(), &(Output->getAsArray().at(Output->getAsArray().size()-1))); - - } else { - Output->getAsArray().push_back(ffw::varObject()); - auto result = &(Output->getAsArray().at(Output->getAsArray().size()-1)); - while(attributePtr != NULL){ - result->getAsObject().insert(std::pair("@" + std::string(attributePtr->Name()), parseVariable(attributePtr->Value()))); - attributePtr = attributePtr->Next(); - } - auto resultPair = result->getAsObject().insert(std::make_pair("content", ffw::varObject())); - convertXML(root->FirstChildElement(), &(resultPair.first->second)); - } - } - } else { - // Parent does not have children - const tinyxml2::XMLAttribute* attributePtr = root->FirstAttribute(); - if(attributePtr == NULL){ - Output->getAsArray().push_back(parseVariable(root->Name())); - } else { - Output->getAsArray().push_back(ffw::varObject()); - auto result = &(Output->getAsArray().at(Output->getAsArray().size()-1)); - while(attributePtr != NULL){ - result->getAsObject().insert(std::pair("@" + std::string(attributePtr->Name()), parseVariable(attributePtr->Value()))); - attributePtr = attributePtr->Next(); - } - } - } -} - -///============================================================================= -static void convertXML(tinyxml2::XMLElement* XML, ffw::var* Output){ - tinyxml2::XMLElement* root = XML; - while(root != NULL){ - // Check if var is a object - if(Output->getType() == ffw::var::type::vObject){ - // Check if element exists in array - auto found = Output->getAsObject().find(root->Name()); - if(found != Output->getAsObject().end()){ - - if(found->second.getType() != ffw::var::type::vArray){ - // Element already exists! Convert to array... - ffw::var temp = found->second; - found->second = ffw::varArray(); - found->second.getAsArray().push_back(temp); - //found->second.getAsArray().push_back(ffw::varArray()); - insertToArray(root, &(found->second)); - } else { - // Element found but is not an array - insertToArray(root, &(found->second)); - } - } else { - // Element does not exists! - insertToObject(root, Output); - } - } else { - // Var is array - insertToArray(root, Output); - } - - root = root->NextSiblingElement(); - } -} - -///============================================================================= -static std::string toUnicode(uint16_t Chr){ - std::string out = "xxxx;"; - char a = Chr / 4096; - char b = (Chr -(a*4096)) / 256; - char c = (Chr -(a*4096) -(b*256)) / 16; - char d = Chr -(a*4096) -(b*256) -(c*16); - if(a >= 10) a = 'A'+(a-10); - else a = '0' + a; - if(b >= 10) b = 'A'+(b-10); - else b = '0' + b; - if(c >= 10) c = 'A'+(c-10); - else c = '0' + c; - if(d >= 10) d = 'A'+(d-10); - else d = '0' + d; - out[0] = a; - out[1] = b; - out[2] = c; - out[3] = d; - return out; -} - -///============================================================================= -static std::string escapeString(std::string Str, bool EscapeUnicode){ - if(Str.size() == 0)return ""; - for(size_t i = 0; ; i++){ - if((unsigned char)Str[i] < 32){ - if(Str[i] == 8){ - Str.replace(i, 1, ""); - i += 7; - } else if(Str[i] == 9){ - Str.replace(i, 1, " "); - i += 7; - } else if(Str[i] == 10){ - Str.replace(i, 1, " "); - i += 7; - } else if(Str[i] == 12){ - Str.replace(i, 1, " "); - i += 7; - } else if(Str[i] == 13){ - Str.replace(i, 1, " "); - i += 7; - } else { - Str.replace(i, 1, "&#x" + toUnicode((unsigned char)(Str[i]))); - i += 7; - } - } else if(uint16_t((uint8_t)Str[i]) > 127 && EscapeUnicode){ - /*size_t p = 0; - while(uint16_t((uint8_t)Str[i+p]) > 127 && i+p < Str.size()){ - p++; - } - std::wstring mstr = ffw::utf8ToWstr(Str.substr(i, p)); - Str.replace(i, p, "&#x" + toUnicode((unsigned short)(mstr[0]))); - i += 7;*/ - - size_t p = 0; - while(uint16_t((uint8_t)Str[i+p]) > 127 && i+p < Str.size()){ - p++; - } - - std::wstring mbstr = ffw::utf8ToWstr(Str.substr(i, p)); - //std::cout << "replacing: " << mstr[0] << std::endl; - std::string unicodeStr; - for(const auto& chr : mbstr){ - unicodeStr += "&#x" + toUnicode((uint16_t)chr); - } - Str.replace(i, p, unicodeStr); - i+= unicodeStr.size(); - - } else if(Str[i] == '\"'){ - Str.replace(i, 1, """); - i += 5; - } else if(Str[i] == '\"'){ - Str.replace(i, 1, "'"); - i += 5; - } else if(Str[i] == '&'){ - Str.replace(i, 1, "&"); - i += 4; - } else if(Str[i] == '<'){ - Str.replace(i, 1, "<"); - i += 3; - } else if(Str[i] == '>'){ - Str.replace(i, 1, ">"); - i += 3; - } - if(i >= Str.size()-1)break; - } - return Str; -} - -///============================================================================= -static bool checkIfAttributesEmpty(ffw::var* Input){ - if(Input->getType() != ffw::var::type::vObject){ - return false; - } - - for(auto it = Input->getAsObject().begin(); it != Input->getAsObject().end(); it++){ - if(it->first[0] == '@')continue; - else return false; - } - - return true; -} - -///============================================================================= -static bool checkIfAttributesContent(ffw::var* Input){ - if(Input->getType() != ffw::var::type::vObject){ - return false; - } - - for(auto it = Input->getAsObject().begin(); it != Input->getAsObject().end(); it++){ - if(it->first[0] == '@')continue; - else if(it->first == "content")continue; - else return false; - } - - return true; -} - -///============================================================================= -static void encodeXMLFunc(std::string* Output, ffw::var* Var, bool Formated, std::string& Indent, bool EscapeUnicode, const std::string& ArrayTag){ - ffw::var::type varType = Var->getType(); - - if(varType == ffw::var::type::vString){ - (*Output) += escapeString(Var->getAsString(), EscapeUnicode); - - } else if(varType == ffw::var::type::vInt){ - (*Output) += ffw::valToString(Var->getAsInt()); - - } else if(varType == ffw::var::type::vFloat){ - (*Output) += ffw::valToString(Var->getAsFloat()); - - } else if(varType == ffw::var::type::vBool){ - if(Var->getAsBool())(*Output) += "true"; - else (*Output) += "false"; - - } else if(varType == ffw::var::type::vNull){ - (*Output) += "null"; - - } else if(varType == ffw::var::type::vObject){ - //(*Output) += Indent - - for(auto it = Var->getAsObject().begin(); it != Var->getAsObject().end(); it++){ - if(checkIfAttributesEmpty(&(it->second))){ - std::string attr; - if(Formated) - attr += Indent + "<" + escapeString(it->first, EscapeUnicode) + " "; - else - attr += "<" + escapeString(it->first, EscapeUnicode) + " "; - for(auto itit = it->second.getAsObject().begin(); itit != it->second.getAsObject().end(); itit++){ - attr += itit->first.substr(1, itit->first.size()-1) + "=\""; - if (itit->second.getType() == ffw::var::type::vString)attr += escapeString(itit->second.getAsString(), EscapeUnicode) + "\""; - else if(itit->second.getType() == ffw::var::type::vInt)attr += ffw::valToString(itit->second.getAsInt()) + "\""; - else if(itit->second.getType() == ffw::var::type::vFloat)attr += ffw::valToString(itit->second.getAsFloat()) + "\""; - else if(itit->second.getType() == ffw::var::type::vBool){ - if(itit->second.getAsBool())attr += "true\""; - else attr += "false\""; - } - else if(itit->second.getType() == ffw::var::type::vNull)attr += "null\""; - else attr += "\""; - } - if(Formated) - (*Output) += attr + " />\n"; - else - (*Output) += attr + " />"; - - } else if(checkIfAttributesContent(&(it->second))){ - std::string attr; - if(Formated) - attr += Indent + "<" + escapeString(it->first, EscapeUnicode) + " "; - else - attr += "<" + escapeString(it->first, EscapeUnicode) + " "; - for(auto itit = it->second.getAsObject().begin(); itit != it->second.getAsObject().end(); itit++){ - if(itit->first[0] != '@')continue; - attr += itit->first.substr(1, itit->first.size()-1) + "=\""; - if (itit->second.getType() == ffw::var::type::vString)attr += escapeString(itit->second.getAsString(), EscapeUnicode) + "\""; - else if(itit->second.getType() == ffw::var::type::vInt)attr += ffw::valToString(itit->second.getAsInt()) + "\""; - else if(itit->second.getType() == ffw::var::type::vFloat)attr += ffw::valToString(itit->second.getAsFloat()) + "\""; - else if(itit->second.getType() == ffw::var::type::vBool){ - if(itit->second.getAsBool())attr += "true\""; - else attr += "false\""; - } - else if(itit->second.getType() == ffw::var::type::vNull)attr += "null\""; - else attr += "\""; - } - - bool isContentObject = false; - bool isContentArray = false; - - if (it->second.getAsObject()["content"].getType() == ffw::var::type::vObject)isContentObject = true; - else if(it->second.getAsObject()["content"].getType() == ffw::var::type::vArray)isContentArray = true; - - if(isContentObject || isContentArray){ - (*Output) += attr + ">\n"; - Indent += " "; - }else{ - (*Output) += attr + ">"; - } - - encodeXMLFunc(Output, &(it->second.getAsObject()["content"]), Formated, Indent, EscapeUnicode, "element"); - - if(Formated){ - if(isContentObject || isContentArray){ - Indent = Indent.substr(0, Indent.size()-4); - (*Output) += Indent + "first, EscapeUnicode) + ">\n"; - } else { - (*Output) += "first, EscapeUnicode) + ">\n"; - } - } else { - (*Output) += "first, EscapeUnicode) + ">"; - } - - } else { - bool inside = false; - bool isArray = false; - if(it->second.getType() == ffw::var::type::vArray)isArray = true; - - if(Formated && - ((it->second.getType() == ffw::var::type::vObject && it->second.getAsObject().begin() != it->second.getAsObject().end()) - || (it->second.getType() == ffw::var::type::vArray && it->second.getAsArray().size() > 0)) ){ - - if(!isArray)(*Output) += Indent + "<" + escapeString(it->first, EscapeUnicode) + ">\n"; - if(!isArray)Indent += " "; - inside = true; - } else if(Formated){ - if(!isArray)(*Output) += Indent + "<" + escapeString(it->first, EscapeUnicode) + ">"; - } else { - if(!isArray)(*Output) += "<" + escapeString(it->first, EscapeUnicode) + ">"; - } - - encodeXMLFunc(Output, &(it->second), Formated, Indent, EscapeUnicode, escapeString(it->first, EscapeUnicode)); - - if(Formated){ - if(inside){ - if(!isArray)Indent = Indent.substr(0, Indent.size()-4); - if(!isArray)(*Output) += Indent + "first, EscapeUnicode) + ">\n"; - } else { - if(!isArray)(*Output) += "first, EscapeUnicode) + ">\n"; - } - } else { - if(!isArray)(*Output) += "first, EscapeUnicode) + ">"; - } - } - } - } else if(varType == ffw::var::type::vArray){ - - for(size_t i = 0; i < Var->getAsArray().size(); i++){ - bool inside = false; - std::string arrayTagCopy = ArrayTag; - if(Var->getAsArray().at(i).getType() == ffw::var::type::vArray){ - arrayTagCopy = "element"; - } - - if(Formated && - ((Var->getAsArray().at(i).getType() == ffw::var::type::vObject && Var->getAsArray().at(i).getAsObject().begin() != Var->getAsArray().at(i).getAsObject().end()) - || (Var->getAsArray().at(i).getType() == ffw::var::type::vArray && Var->getAsArray().at(i).getAsArray().size() > 0)) ){ - (*Output) += Indent + "<" + arrayTagCopy + ">\n"; - Indent += " "; - inside = true; - } else if(Formated){ - (*Output) += Indent + "<" + arrayTagCopy + ">"; - } else { - (*Output) += "<" + arrayTagCopy + ">"; - } - - encodeXMLFunc(Output, &(Var->getAsArray().at(i)), Formated, Indent, EscapeUnicode, "element"); - if(Formated){ - if(inside){ - Indent = Indent.substr(0, Indent.size()-4); - (*Output) += Indent + "\n"; - } else { - (*Output) += "\n"; - } - } else { - (*Output) += ""; - } - } - } -} - -///============================================================================= -bool ffw::decodeXML(const std::string& Str, ffw::var* Output){ - if(Output == NULL)return false; - if(Str.size() == 0)return false; - - tinyxml2::XMLDocument doc; - doc.Parse(Str.c_str()); - if(doc.Error())return false; - *Output = ffw::varObject(); - convertXML(doc.RootElement(), Output); - return true; -} - -///============================================================================= -void ffw::encodeXML(std::string* Output, ffw::var* Var, bool Formated, bool EscapeUnicode){ - if(Output == NULL)return; - if(Var == NULL)return; - - std::string indent; - Output->clear(); - if(EscapeUnicode) - (*Output) += ""; - else - (*Output) += ""; - if(Formated)(*Output) += "\n"; - encodeXMLFunc(Output, Var, Formated, indent, EscapeUnicode, ""); -} - -///============================================================================= -bool ffw::loadXML(const std::wstring& Path, ffw::var* Output){ - return loadXML(wstrToAnsi(Path), Output); -} - -///============================================================================= -bool ffw::loadXML(const std::string& Path, ffw::var* Output){ - if(Output == NULL)return false; - - tinyxml2::XMLDocument doc; - doc.LoadFile(Path.c_str()); - if(doc.Error())return false; - *Output = ffw::varObject(); - convertXML(doc.RootElement(), Output); - return true; -} - -///============================================================================= -bool ffw::saveXML(const std::string& Path, ffw::var* Input, bool Formated, bool EscapeUnicode){ - return saveXML(utf8ToWstr(Path), Input, Formated, EscapeUnicode); -} - -///============================================================================= -bool ffw::saveXML(const std::wstring& Path, ffw::var* Input, bool Formated, bool EscapeUnicode){ - if(Input == NULL)return false; - - ffw::file output; - if(!output.open(Path, false, true, true)){ - return false; - } - - std::string encoded; - encodeXML(&encoded, Input, Formated, EscapeUnicode); - - output.write(&encoded[0], encoded.size()); - output.close(); - return true; -} diff --git a/third-party-libs/FragmentFramework/include/utilities/logger.cpp b/third-party-libs/FragmentFramework/include/utilities/logger.cpp deleted file mode 100644 index 5b4df00..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/logger.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#include "logger.h" -#include -#include -#include -#include -#include -#include -#include "../systemUtils/win32SysUtils.h" - -static int verbosity = 0; -static std::string path = "."; -static HANDLE hConsole; -static bool initialized = false; -static bool consoleInit = false; -static bool consoleOut = true; - -///============================================================================= -void ffw::logger::initLogger(std::string Path){ - clearLog(); - path = Path + "\\log.txt"; - initialized = true; -} - -///============================================================================= -void ffw::logger::initLogger(){ - clearLog(); - path = getExecutablePath() + "\\log.txt"; - initialized = true; -} - -///============================================================================= -std::ostringstream& ffw::logger::print() { - type = 2; - os << getTime() + "[NOTICE] "; - return os; -} - -///============================================================================= -std::ostringstream& ffw::logger::verbose() { - type = 0; - os << getTime() + "[VERBOSE] "; - return os; -} - -///============================================================================= -std::ostringstream& ffw::logger::debug() { - type = 1; - os << getTime() + "[DEBUG] "; - return os; -} - -///============================================================================= -std::ostringstream& ffw::logger::notice() { - type = 2; - os << getTime() + "[NOTICE] "; - return os; -} - -///============================================================================= -std::ostringstream& ffw::logger::info() { - type = 3; - os << getTime() + "[INFO] "; - return os; -} - -///============================================================================= -std::ostringstream& ffw::logger::warning() { - type = 4; - os << getTime() + "[WARNING] "; - return os; -} - -///============================================================================= -std::ostringstream& ffw::logger::error() { - type = 5; - os << getTime() + "[ERROR] "; - return os; -} - -///============================================================================= -void ffw::logger::clearLog(){ - std::ofstream file; - file.open("log.txt", std::ofstream::out | std::ofstream::trunc); - file << ""; - file.close(); -} - -///============================================================================= -void ffw::logger::setVerbosity(int Level){ - verbosity = Level; - if(verbosity > 5)verbosity = 5; -} - -///============================================================================= -ffw::logger::~logger() { - os << "\n"; - - if(consoleOut){ - if(!consoleInit){ - hConsole = GetStdHandle(STD_OUTPUT_HANDLE); - consoleInit = true; - } - if(type >= verbosity){ - if (type == 0) SetConsoleTextAttribute(hConsole, 8); - else if(type == 1) SetConsoleTextAttribute(hConsole, 7); - else if(type == 2) SetConsoleTextAttribute(hConsole, 15); - else if(type == 3) SetConsoleTextAttribute(hConsole, 11); - else if(type == 4) SetConsoleTextAttribute(hConsole, 14); - else if(type == 5) SetConsoleTextAttribute(hConsole, 12); - std::cout << os.str(); - SetConsoleTextAttribute(hConsole, 7); - } - } - - if(initialized){ - addLine(); - } - os.clear(); -} - -///============================================================================= -void ffw::logger::addLine() { - std::ofstream file; - file.open(path, std::ofstream::out | std::ofstream::app); - file << os.str(); - file.close(); -} - -///============================================================================= -void ffw::logger::setConsoleOutput(bool Enabled){ - consoleOut = Enabled; -} - -///============================================================================= -std::string ffw::logger::getTime() { - time_t rawtime; - struct tm * timeInfo; - - time (&rawtime); - timeInfo = localtime(&rawtime); - int timeDay = timeInfo->tm_mday; - int timeMonth = timeInfo->tm_mon +1; - int timeYear = timeInfo->tm_year +1900; - int timeHours = timeInfo->tm_hour; - int timeMinutes = timeInfo->tm_min; - int timeSeconds = timeInfo->tm_sec; - - std::ostringstream timeMessage; - - if(timeDay < 10) timeMessage << "0" << timeDay << "-"; - else timeMessage << timeDay << "-"; - - if(timeMonth < 10) timeMessage << "0" << timeMonth << "-"; - else timeMessage << timeMonth << "-"; - - timeMessage << timeYear << " ["; - - if(timeHours < 10) timeMessage << "0" << timeHours << ":"; - else timeMessage << timeHours << ":"; - - if(timeMinutes < 10) timeMessage << "0" << timeMinutes << ":"; - else timeMessage << timeMinutes << ":"; - - if(timeSeconds < 10) timeMessage << "0" << timeSeconds << "] "; - else timeMessage << timeSeconds << "] "; - - return timeMessage.str(); -} -///============================================================================= diff --git a/third-party-libs/FragmentFramework/include/utilities/mutex.cpp b/third-party-libs/FragmentFramework/include/utilities/mutex.cpp deleted file mode 100644 index 9053ede..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/mutex.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#include "mutex.h" - -// Compile for Visual Studio -#ifdef _MSC_VER -#include -///============================================================================= -ffw::mutex::mutex(){ - // std::mutex uses it's own constructor -} - -///============================================================================= -ffw::mutex::~mutex(){ - // std::mutex uses it's own destructor -} - -///============================================================================= -bool ffw::mutex::lock(){ - try { - mut.lock(); - } catch (const std::system_error& e) { - return false; - } - return true; -} - -///============================================================================= -bool ffw::mutex::tryLock(){ - return mut.try_lock(); -} - -///============================================================================= -bool ffw::mutex::unlock(){ - mut.unlock(); - return true; -} -#endif - -// Compile for MinGW -#ifdef __MINGW32__ -///============================================================================= -ffw::mutex::mutex(){ - pthread_mutex_init(&mut, NULL); -} - -///============================================================================= -ffw::mutex::~mutex(){ - pthread_mutex_destroy(&mut); -} - -///============================================================================= -bool ffw::mutex::lock(){ - return (pthread_mutex_lock(&mut) == 0); -} - -///============================================================================= -bool ffw::mutex::tryLock(){ - return (pthread_mutex_trylock(&mut) == 0); -} - -///============================================================================= -bool ffw::mutex::unlock(){ - return (pthread_mutex_unlock(&mut) == 0); -} -#endif diff --git a/third-party-libs/FragmentFramework/include/utilities/mutex.h b/third-party-libs/FragmentFramework/include/utilities/mutex.h deleted file mode 100644 index b20bcf9..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/mutex.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_MUTEX -#define FFW_MUTEX - -#include "../dll.h" - -// Compile for Visual Studio -#ifdef _MSC_VER -#include - -namespace ffw{ - class FFW_API mutex { - public: - mutex(); - ~mutex(); - bool lock(); - bool tryLock(); - bool unlock(); - - private: - std::mutex mut; - }; -}; - -#endif - -// Compile for MinGW -#ifdef __MINGW32__ -#include - -/*! - @ingroup Utilities -*/ -namespace ffw{ - /*! - @memberof ffw - @ingroup Utilities - */ - class FFW_API mutex { - public: - mutex(); - ~mutex(); - /*! - @memberof mutex - @ingroup Utilities - */ - bool lock(); - /*! - @memberof mutex - @ingroup Utilities - */ - bool tryLock(); - /*! - @memberof mutex - @ingroup Utilities - */ - bool unlock(); - - private: - pthread_mutex_t mut; - }; -}; -#endif - -#endif diff --git a/third-party-libs/FragmentFramework/include/utilities/serialization.cpp b/third-party-libs/FragmentFramework/include/utilities/serialization.cpp deleted file mode 100644 index 4423818..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/serialization.cpp +++ /dev/null @@ -1,479 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#include "serialization.h" -#include "../math/stringMath.h" -#include "loadSaveJson.h" -#include "loadSaveTxt.h" - -///============================================================================= -template -static void serializeVec2(ffw::var* Data, const ffw::serialization::item& Item){ - ffw::varArray dataArray; - - dataArray.push_back(static_cast*>(Item.ptr)->x); - dataArray.push_back(static_cast*>(Item.ptr)->y); - - Data->getAsObject().insert(std::make_pair(Item.name, dataArray)); -} - -///============================================================================= -template -static void serializeVec3(ffw::var* Data, const ffw::serialization::item& Item){ - ffw::varArray dataArray; - - dataArray.push_back(static_cast*>(Item.ptr)->x); - dataArray.push_back(static_cast*>(Item.ptr)->y); - dataArray.push_back(static_cast*>(Item.ptr)->z); - - Data->getAsObject().insert(std::make_pair(Item.name, dataArray)); -} - -///============================================================================= -template -static void serializeVec4(ffw::var* Data, const ffw::serialization::item& Item){ - ffw::varArray dataArray; - - dataArray.push_back(static_cast*>(Item.ptr)->x); - dataArray.push_back(static_cast*>(Item.ptr)->y); - dataArray.push_back(static_cast*>(Item.ptr)->z); - dataArray.push_back(static_cast*>(Item.ptr)->w); - - Data->getAsObject().insert(std::make_pair(Item.name, dataArray)); -} - -///============================================================================= -bool ffw::serialization::serializeAsJson(const std::string& Path, bool Formated){ - return serializeAsJson(utf8ToWstr(Path), Formated); -} - -///============================================================================= -bool ffw::serialization::serializeAsJson(const std::wstring& Path, bool Formated){ - ffw::var data = ffw::varObject(); - // Test first - if(!saveTXT(Path, "..."))return false; - - serializeAsVar(&data, Formated); - return saveJSON(Path, &data, Formated, true); -} - -///============================================================================= -bool ffw::serialization::serializeAsVar(ffw::var* Data, bool Formated){ - for(const auto& item : varList){ - - if (item.code == typeid(int).hash_code()){ - Data->getAsObject().insert(std::make_pair(item.name, *static_cast(item.ptr))); - - } else if(item.code == typeid(float).hash_code()){ - Data->getAsObject().insert(std::make_pair(item.name, *static_cast(item.ptr))); - - } else if(item.code == typeid(bool).hash_code()){ - Data->getAsObject().insert(std::make_pair(item.name, *static_cast(item.ptr))); - - } else if(item.code == typeid(std::string).hash_code()){ - Data->getAsObject().insert(std::make_pair(item.name, *static_cast(item.ptr))); - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray dataArray; - - for(const auto& element : *static_cast*>(item.ptr)){ - dataArray.push_back(element); - } - - Data->getAsObject().insert(std::make_pair(item.name, dataArray)); - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray dataArray; - - for(const auto& element : *static_cast*>(item.ptr)){ - dataArray.push_back(element); - } - - Data->getAsObject().insert(std::make_pair(item.name, dataArray)); - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray dataArray; - - for(const bool& element : *static_cast*>(item.ptr)){ - dataArray.push_back(element); - } - - Data->getAsObject().insert(std::make_pair(item.name, dataArray)); - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray dataArray; - - for(const auto& element : *static_cast*>(item.ptr)){ - dataArray.push_back(element); - } - - Data->getAsObject().insert(std::make_pair(item.name, dataArray)); - - } else if(item.code == typeid(ffw::vec2f).hash_code()){ - serializeVec2(Data, item); - - } else if(item.code == typeid(ffw::vec3f).hash_code()){ - serializeVec3(Data, item); - - } else if(item.code == typeid(ffw::vec4f).hash_code()){ - serializeVec4(Data, item); - - } else if(item.code == typeid(ffw::vec2i).hash_code()){ - serializeVec2(Data, item); - - } else if(item.code == typeid(ffw::vec3i).hash_code()){ - serializeVec3(Data, item); - - } else if(item.code == typeid(ffw::vec4i).hash_code()){ - serializeVec4(Data, item); - - } else if(item.code == typeid(ffw::color).hash_code()){ - ffw::varArray dataArray; - - dataArray.push_back(static_cast(item.ptr)->r); - dataArray.push_back(static_cast(item.ptr)->g); - dataArray.push_back(static_cast(item.ptr)->b); - dataArray.push_back(static_cast(item.ptr)->a); - - Data->getAsObject().insert(std::make_pair(item.name, dataArray)); - - } else if(item.code == typeid(ffw::quaternion).hash_code()){ - ffw::varArray dataArray; - - dataArray.push_back(static_cast(item.ptr)->x); - dataArray.push_back(static_cast(item.ptr)->y); - dataArray.push_back(static_cast(item.ptr)->z); - dataArray.push_back(static_cast(item.ptr)->w); - - Data->getAsObject().insert(std::make_pair(item.name, dataArray)); - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray dataArray; - - for(const auto& element : *static_cast*>(item.ptr)){ - dataArray.push_back(ffw::varArray()); - auto& subDataArray = dataArray[dataArray.size()-1].getAsArray(); - subDataArray.push_back(element.x); - subDataArray.push_back(element.y); - } - - Data->getAsObject().insert(std::make_pair(item.name, dataArray)); - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray dataArray; - - for(const auto& element : *static_cast*>(item.ptr)){ - dataArray.push_back(ffw::varArray()); - auto& subDataArray = dataArray[dataArray.size()-1].getAsArray(); - subDataArray.push_back(element.x); - subDataArray.push_back(element.y); - subDataArray.push_back(element.z); - } - - Data->getAsObject().insert(std::make_pair(item.name, dataArray)); - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray dataArray; - - for(const auto& element : *static_cast*>(item.ptr)){ - dataArray.push_back(ffw::varArray()); - auto& subDataArray = dataArray[dataArray.size()-1].getAsArray(); - subDataArray.push_back(element.x); - subDataArray.push_back(element.y); - subDataArray.push_back(element.z); - subDataArray.push_back(element.w); - } - - Data->getAsObject().insert(std::make_pair(item.name, dataArray)); - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray dataArray; - - for(const auto& element : *static_cast*>(item.ptr)){ - dataArray.push_back(ffw::varArray()); - auto& subDataArray = dataArray[dataArray.size()-1].getAsArray(); - subDataArray.push_back(element.x); - subDataArray.push_back(element.y); - } - - Data->getAsObject().insert(std::make_pair(item.name, dataArray)); - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray dataArray; - - for(const auto& element : *static_cast*>(item.ptr)){ - dataArray.push_back(ffw::varArray()); - auto& subDataArray = dataArray[dataArray.size()-1].getAsArray(); - subDataArray.push_back(element.x); - subDataArray.push_back(element.y); - subDataArray.push_back(element.z); - } - - Data->getAsObject().insert(std::make_pair(item.name, dataArray)); - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray dataArray; - - for(const auto& element : *static_cast*>(item.ptr)){ - dataArray.push_back(ffw::varArray()); - auto& subDataArray = dataArray[dataArray.size()-1].getAsArray(); - subDataArray.push_back(element.x); - subDataArray.push_back(element.y); - subDataArray.push_back(element.z); - subDataArray.push_back(element.w); - } - - Data->getAsObject().insert(std::make_pair(item.name, dataArray)); - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray dataArray; - - for(const auto& element : *static_cast*>(item.ptr)){ - dataArray.push_back(ffw::varArray()); - auto& subDataArray = dataArray[dataArray.size()-1].getAsArray(); - subDataArray.push_back(element.r); - subDataArray.push_back(element.g); - subDataArray.push_back(element.b); - subDataArray.push_back(element.a); - } - - Data->getAsObject().insert(std::make_pair(item.name, dataArray)); - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray dataArray; - - for(const auto& element : *static_cast*>(item.ptr)){ - dataArray.push_back(ffw::varArray()); - auto& subDataArray = dataArray[dataArray.size()-1].getAsArray(); - subDataArray.push_back(element.x); - subDataArray.push_back(element.y); - subDataArray.push_back(element.z); - subDataArray.push_back(element.w); - } - - Data->getAsObject().insert(std::make_pair(item.name, dataArray)); - } - } - return true; -} - -///============================================================================= -bool ffw::serialization::deserializeAsJson(const std::string& Path, std::vector* Missing){ - return deserializeAsJson(utf8ToWstr(Path), Missing); -} - -///============================================================================= -bool ffw::serialization::deserializeAsJson(const std::wstring& Path, std::vector* Missing){ - ffw::var data; - if(!loadJSON(Path, &data)){ - return false; - } - - return deserializeAsVar(&data, Missing); -} - -///============================================================================= -bool ffw::serialization::deserializeAsVar(ffw::var* Data, std::vector* Missing){ - if(Data->getType() != var::type::vObject){ - return false; - } - - bool result = true; - for(const auto& item : varList){ - const auto& found = Data->getAsObject().find(item.name); - - if(found != Data->getAsObject().end()){ - - if (item.code == typeid(int).hash_code()){ - *static_cast(item.ptr) = found->second.getAsInt(); - - } else if(item.code == typeid(float).hash_code()){ - *static_cast(item.ptr) = found->second.getAsFloat(); - - } else if(item.code == typeid(bool).hash_code()){ - *static_cast(item.ptr) = found->second.getAsBool(); - - } else if(item.code == typeid(std::string).hash_code()){ - *static_cast(item.ptr) = found->second.getAsString(); - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray& elements = found->second.getAsArray(); - - for(auto& element : elements){ - static_cast*>(item.ptr)->push_back(element.getAsInt()); - } - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray& elements = found->second.getAsArray(); - - for(auto& element : elements){ - static_cast*>(item.ptr)->push_back(element.getAsFloat()); - } - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray& elements = found->second.getAsArray(); - - for(auto& element : elements){ - static_cast*>(item.ptr)->push_back(element.getAsBool()); - } - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray& elements = found->second.getAsArray(); - - for(auto& element : elements){ - static_cast*>(item.ptr)->push_back(element.getAsString()); - } - - } else if(item.code == typeid(ffw::vec2f).hash_code()){ - ffw::varArray& elements = found->second.getAsArray(); - if(elements.size() != 2){Missing->push_back(item.name); result = false; continue;} - - static_cast(item.ptr)->x = elements[0].getAsFloat(); - static_cast(item.ptr)->y = elements[1].getAsFloat(); - - } else if(item.code == typeid(ffw::vec3f).hash_code()){ - ffw::varArray& elements = found->second.getAsArray(); - if(elements.size() != 3){Missing->push_back(item.name); result = false; continue;} - - static_cast(item.ptr)->x = elements[0].getAsFloat(); - static_cast(item.ptr)->y = elements[1].getAsFloat(); - static_cast(item.ptr)->z = elements[2].getAsFloat(); - - } else if(item.code == typeid(ffw::vec4f).hash_code()){ - ffw::varArray& elements = found->second.getAsArray(); - if(elements.size() != 4){Missing->push_back(item.name); result = false; continue;} - - static_cast(item.ptr)->x = elements[0].getAsFloat(); - static_cast(item.ptr)->y = elements[1].getAsFloat(); - static_cast(item.ptr)->z = elements[2].getAsFloat(); - static_cast(item.ptr)->w = elements[3].getAsFloat(); - - } else if(item.code == typeid(ffw::vec2i).hash_code()){ - ffw::varArray& elements = found->second.getAsArray(); - if(elements.size() != 2){Missing->push_back(item.name); result = false; continue;} - - static_cast(item.ptr)->x = elements[0].getAsInt(); - static_cast(item.ptr)->y = elements[1].getAsInt(); - - } else if(item.code == typeid(ffw::vec3i).hash_code()){ - ffw::varArray& elements = found->second.getAsArray(); - if(elements.size() != 3){Missing->push_back(item.name); result = false; continue;} - - static_cast(item.ptr)->x = elements[0].getAsInt(); - static_cast(item.ptr)->y = elements[1].getAsInt(); - static_cast(item.ptr)->z = elements[2].getAsInt(); - - } else if(item.code == typeid(ffw::vec4i).hash_code()){ - ffw::varArray& elements = found->second.getAsArray(); - if(elements.size() != 4){Missing->push_back(item.name); result = false; continue;} - - static_cast(item.ptr)->x = elements[0].getAsInt(); - static_cast(item.ptr)->y = elements[1].getAsInt(); - static_cast(item.ptr)->z = elements[2].getAsInt(); - static_cast(item.ptr)->w = elements[3].getAsInt(); - - } else if(item.code == typeid(ffw::color).hash_code()){ - ffw::varArray& elements = found->second.getAsArray(); - if(elements.size() != 4){Missing->push_back(item.name); result = false; continue;} - - static_cast(item.ptr)->r = elements[0].getAsFloat(); - static_cast(item.ptr)->g = elements[1].getAsFloat(); - static_cast(item.ptr)->b = elements[2].getAsFloat(); - static_cast(item.ptr)->a = elements[3].getAsFloat(); - - } else if(item.code == typeid(ffw::quaternion).hash_code()){ - ffw::varArray& elements = found->second.getAsArray(); - if(elements.size() != 4){Missing->push_back(item.name); result = false; continue;} - - static_cast(item.ptr)->x = elements[0].getAsFloat(); - static_cast(item.ptr)->y = elements[1].getAsFloat(); - static_cast(item.ptr)->z = elements[2].getAsFloat(); - static_cast(item.ptr)->w = elements[3].getAsFloat(); - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray& elements = found->second.getAsArray(); - - for(auto& element : elements){ - auto& subElements = element.getAsArray(); - if(subElements.size() != 2)continue; - static_cast*>(item.ptr)->push_back(ffw::vec2f(subElements[0].getAsFloat(), subElements[1].getAsFloat())); - } - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray& elements = found->second.getAsArray(); - - for(auto& element : elements){ - auto& subElements = element.getAsArray(); - if(subElements.size() != 3)continue; - static_cast*>(item.ptr)->push_back(ffw::vec3f(subElements[0].getAsFloat(), subElements[1].getAsFloat(), subElements[2].getAsFloat())); - } - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray& elements = found->second.getAsArray(); - - for(auto& element : elements){ - auto& subElements = element.getAsArray(); - if(subElements.size() != 4)continue; - static_cast*>(item.ptr)->push_back(ffw::vec4f(subElements[0].getAsFloat(), subElements[1].getAsFloat(), subElements[2].getAsFloat(), subElements[3].getAsFloat())); - } - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray& elements = found->second.getAsArray(); - - for(auto& element : elements){ - auto& subElements = element.getAsArray(); - if(subElements.size() != 2)continue; - static_cast*>(item.ptr)->push_back(ffw::vec2i(subElements[0].getAsInt(), subElements[1].getAsInt())); - } - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray& elements = found->second.getAsArray(); - - for(auto& element : elements){ - auto& subElements = element.getAsArray(); - if(subElements.size() != 3)continue; - static_cast*>(item.ptr)->push_back(ffw::vec3i(subElements[0].getAsInt(), subElements[1].getAsInt(), subElements[2].getAsInt())); - } - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray& elements = found->second.getAsArray(); - - for(auto& element : elements){ - auto& subElements = element.getAsArray(); - if(subElements.size() != 4)continue; - static_cast*>(item.ptr)->push_back(ffw::vec4i(subElements[0].getAsInt(), subElements[1].getAsInt(), subElements[2].getAsInt(), subElements[3].getAsInt())); - } - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray& elements = found->second.getAsArray(); - - for(auto& element : elements){ - auto& subElements = element.getAsArray(); - - if(subElements.size() != 4)continue; - static_cast*>(item.ptr)->push_back(ffw::color(subElements[0].getAsFloat(), subElements[1].getAsFloat(), subElements[2].getAsFloat(), subElements[3].getAsFloat())); - } - - - } else if(item.code == typeid(std::vector).hash_code()){ - ffw::varArray& elements = found->second.getAsArray(); - - for(auto& element : elements){ - auto& subElements = element.getAsArray(); - if(subElements.size() != 4)continue; - static_cast*>(item.ptr)->push_back(ffw::quaternion(subElements[0].getAsFloat(), subElements[1].getAsFloat(), subElements[2].getAsFloat(), subElements[3].getAsFloat())); - } - - } - - } else { - if(Missing != NULL) Missing->push_back(item.name); - result = false; - } - } - - return result; -} diff --git a/third-party-libs/FragmentFramework/include/utilities/thread.cpp b/third-party-libs/FragmentFramework/include/utilities/thread.cpp deleted file mode 100644 index 5e7391f..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/thread.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#include "thread.h" - -// Compile for Visual Studio -#ifdef _MSC_VER -#include -///============================================================================= -ffw::thread::thread(){ - threadFunc = NULL; - dataPtr = NULL; - sthread = NULL; -} - -///============================================================================= -ffw::thread::~thread(){ - if (sthread != NULL){ - delete sthread; - sthread = NULL; - } -} - -///============================================================================= -bool ffw::thread::start(void* DataPtr){ - if (sthread != NULL){ - delete sthread; - sthread = NULL; - } - - dataPtr = DataPtr; - if(threadFunc != NULL){ - try { - sthread = new std::thread(threadFunc, dataPtr); - } - catch (const std::system_error& e) { - return false; - } - } else if(threadFuncMem != nullptr){ - try { - sthread = new std::thread(internalThreadFunc, this); - } - catch (const std::system_error& e) { - return false; - } - } - - return false; -} - -///============================================================================= -bool ffw::thread::join(){ - if(sthread == NULL)return false; - try { - sthread->join(); - } catch (const std::system_error& e) { - return false; - } - return true; -} - -///============================================================================= -bool ffw::thread::join(void** ReturnValue){ - if (sthread == NULL)return false; - try { - sthread->join(); - // Return value is not supported by std::thread :( - // *ReturnValue = ???; - } catch (const std::system_error& e) { - return false; - } - return true; -} - -///============================================================================= -void* ffw::thread::internalThreadFunc(void* This){ - return static_cast(This)->threadFuncMem(static_cast(This)->dataPtr); -} - -///============================================================================= -void ffw::thread::bindFunction(void* (*Func)(void*)){ - threadFunc = Func; -} - -///============================================================================= -void ffw::thread::bindFunction(std::function Func){ - threadFuncMem = Func; -} -#endif - -// Compile for MinGW -#ifdef __MINGW32__ -///============================================================================= -ffw::thread::thread(){ - threadFunc = NULL; - dataPtr = NULL; - //threadFuncMem = nullptr; -} - -///============================================================================= -ffw::thread::~thread(){ -} - -///============================================================================= -bool ffw::thread::start(void* DataPtr){ - dataPtr = DataPtr; - if(threadFunc != NULL){ - return (pthread_create(&pthread, NULL, threadFunc, dataPtr) == 0); - - } else if(threadFuncMem != nullptr){ - return (pthread_create(&pthread, NULL, internalThreadFunc, this) == 0); - } - - return false; -} - -///============================================================================= -bool ffw::thread::join(){ - return (pthread_join(pthread, NULL) == 0); -} - -///============================================================================= -bool ffw::thread::join(void** ReturnValue){ - return (pthread_join(pthread, ReturnValue) == 0); -} - -///============================================================================= -void* ffw::thread::internalThreadFunc(void* This){ - //((thread *)This)->threadFuncMem(((thread *)This)->dataPtr); - return static_cast(This)->threadFuncMem(static_cast(This)->dataPtr); -} - -///============================================================================= -void ffw::thread::bindFunction(void* (*Func)(void*)){ - threadFunc = Func; -} - -///============================================================================= -void ffw::thread::bindFunction(std::function Func){ - threadFuncMem = Func; -} -#endif diff --git a/third-party-libs/FragmentFramework/include/utilities/thread.h b/third-party-libs/FragmentFramework/include/utilities/thread.h deleted file mode 100644 index 5bcda79..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/thread.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_THREAD -#define FFW_THREAD - -#include "../dll.h" - -// Compile for Visual Studio -#ifdef _MSC_VER -#include -#include - -namespace ffw{ - class FFW_API thread{ - public: - thread(); - virtual ~thread(); - bool start(void* DataPtr); - bool join(); - bool join(void** ReturnValue); - void bindFunction(void* (*Func)(void*)); - void bindFunction(std::function Func); - - private: - static void *internalThreadFunc(void* This); - void* (*threadFunc)(void*); - std::function threadFuncMem; - std::thread* sthread; - void* dataPtr; - }; -}; - -#endif - -// Compile for MinGW -#ifdef __MINGW32__ -#include -#include - -/*! - @ingroup Utilities -*/ -namespace ffw{ - /*! - @memberof ffw - @ingroup Utilities - */ - class FFW_API thread{ - public: - thread(); - virtual ~thread(); - /*! - @memberof thread - @ingroup Utilities - */ - bool start(void* DataPtr); - /*! - @memberof thread - @ingroup Utilities - */ - bool join(); - /*! - @memberof thread - @ingroup Utilities - */ - bool join(void** ReturnValue); - /*! - @memberof thread - @ingroup Utilities - */ - void bindFunction(void* (*Func)(void*)); - /*! - @memberof thread - @ingroup Utilities - */ - void bindFunction(std::function Func); - - private: - static void *internalThreadFunc(void* This); - void* (*threadFunc)(void*); - std::function threadFuncMem; - pthread_t pthread; - void* dataPtr; - }; -}; -#endif - -#endif diff --git a/third-party-libs/FragmentFramework/include/utilities/timer.cpp b/third-party-libs/FragmentFramework/include/utilities/timer.cpp deleted file mode 100644 index ee70e99..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/timer.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#include "timer.h" - -///============================================================================= -ffw::timer::timer(){ - /*beginTime.QuadPart = 0; - endTime.QuadPart = 0; - QueryPerformanceFrequency(&frequency);*/ -} - -///============================================================================= -void ffw::timer::begin(){ - /*QueryPerformanceCounter(&beginTime);*/ - t1 = std::chrono::steady_clock::now(); -} - -///============================================================================= -void ffw::timer::end(){ - /*QueryPerformanceCounter(&endTime);*/ - t2 = std::chrono::steady_clock::now(); -} - -///============================================================================= -double ffw::timer::getTime(){ - /*LARGE_INTEGER time; - time.QuadPart = endTime.QuadPart - beginTime.QuadPart; - return ((double)time.QuadPart /(double)frequency.QuadPart);*/ - std::chrono::duration time_span = std::chrono::duration_cast>(t2 - t1); - return time_span.count(); -} -///============================================================================= -uint64_t ffw::timer::getTimeMilli(){ - //chrono::duration (diff).count() - return std::chrono::duration_cast(t2 - t1).count(); -} - -///============================================================================= -uint64_t ffw::timer::getTimeMicro(){ - //chrono::duration (diff).count() - return std::chrono::duration_cast(t2 - t1).count(); -} - -///============================================================================= diff --git a/third-party-libs/FragmentFramework/include/utilities/usleep.cpp b/third-party-libs/FragmentFramework/include/utilities/usleep.cpp deleted file mode 100644 index 18467e4..0000000 --- a/third-party-libs/FragmentFramework/include/utilities/usleep.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#include "usleep.h" -#include - -///============================================================================= -void ffw::usleep(int64_t Micros) { - HANDLE timer; - LARGE_INTEGER delayInterval; - - // Convert to 100 nanosecond interval, negative value indicates relative time - delayInterval.QuadPart = -(10*Micros); - - timer = CreateWaitableTimer(NULL, TRUE, NULL); - SetWaitableTimer(timer, &delayInterval, 0, NULL, NULL, 0); - WaitForSingleObject(timer, INFINITE); - CloseHandle(timer); -} -///============================================================================= diff --git a/third-party-libs/FragmentFramework/include/window.h b/third-party-libs/FragmentFramework/include/window.h deleted file mode 100644 index 45469d2..0000000 --- a/third-party-libs/FragmentFramework/include/window.h +++ /dev/null @@ -1,104 +0,0 @@ -/* -* This file is part of FragmentFramework framework. -* Copyright (C) 2013-2015 by Matus Novak matusnov@gmail.com -* Licensed under the MIT License -*/ - -#ifndef FFW_RENDER_WINDOW -#define FFW_RENDER_WINDOW - -#include -#include - -/*! - @ingroup Core -*/ -namespace ffw { - /*! - @memberof ffw - @ingroup Core - */ - class window { - public: - window(){ - } - /*! - @memberof window - @ingroup Core - */ - virtual ~window(){ - } - /*! - @memberof window - @ingroup Core - */ - virtual void setup() = 0; - /*! - @memberof window - @ingroup Core - */ - virtual void update() = 0; - /*! - @memberof window - @ingroup Core - */ - virtual void render() = 0; - /*! - @memberof window - @ingroup Core - */ - virtual void destroy(){} - /*! - @memberof window - @ingroup Core - */ - virtual void textInput(unsigned int C){} - /*! - @memberof window - @ingroup Core - */ - virtual void keyPressed(int Key, int Mode){} - /*! - @memberof window - @ingroup Core - */ - virtual void mouseMoved(int MouseX, int MouseY){} - /*! - @memberof window - @ingroup Core - */ - virtual void mouseScroll(int scroll){} - /*! - @memberof window - @ingroup Core - */ - virtual void mouseButton(int button, int mode){} - /*! - @memberof window - @ingroup Core - */ - virtual void windowResized(int width, int height){} - /*! - @memberof window - @ingroup Core - */ - virtual void windowMoved(int windowX, int windowY){} - /*! - @memberof window - @ingroup Core - */ - virtual void windowShouldClose(){} - /*! - @memberof window - @ingroup Core - */ - virtual void windowFocus(int focus){} - /*! - @memberof window - @ingroup Core - */ - virtual void filesDropped(std::vector FileList){} - }; -}; - -#endif diff --git a/third-party-libs/FragmentFramework/lib/mingw/FragmentFramework.dll b/third-party-libs/FragmentFramework/lib/mingw/FragmentFramework.dll deleted file mode 100644 index e11d8c7..0000000 Binary files a/third-party-libs/FragmentFramework/lib/mingw/FragmentFramework.dll and /dev/null differ diff --git a/third-party-libs/zlib/FAQ b/third-party-libs/zlib/FAQ deleted file mode 100644 index 99b7cf9..0000000 --- a/third-party-libs/zlib/FAQ +++ /dev/null @@ -1,368 +0,0 @@ - - Frequently Asked Questions about zlib - - -If your question is not there, please check the zlib home page -http://zlib.net/ which may have more recent information. -The lastest zlib FAQ is at http://zlib.net/zlib_faq.html - - - 1. Is zlib Y2K-compliant? - - Yes. zlib doesn't handle dates. - - 2. Where can I get a Windows DLL version? - - The zlib sources can be compiled without change to produce a DLL. See the - file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the - precompiled DLL are found in the zlib web site at http://zlib.net/ . - - 3. Where can I get a Visual Basic interface to zlib? - - See - * http://marknelson.us/1997/01/01/zlib-engine/ - * win32/DLL_FAQ.txt in the zlib distribution - - 4. compress() returns Z_BUF_ERROR. - - Make sure that before the call of compress(), the length of the compressed - buffer is equal to the available size of the compressed buffer and not - zero. For Visual Basic, check that this parameter is passed by reference - ("as any"), not by value ("as long"). - - 5. deflate() or inflate() returns Z_BUF_ERROR. - - Before making the call, make sure that avail_in and avail_out are not zero. - When setting the parameter flush equal to Z_FINISH, also make sure that - avail_out is big enough to allow processing all pending input. Note that a - Z_BUF_ERROR is not fatal--another call to deflate() or inflate() can be - made with more input or output space. A Z_BUF_ERROR may in fact be - unavoidable depending on how the functions are used, since it is not - possible to tell whether or not there is more output pending when - strm.avail_out returns with zero. See http://zlib.net/zlib_how.html for a - heavily annotated example. - - 6. Where's the zlib documentation (man pages, etc.)? - - It's in zlib.h . Examples of zlib usage are in the files test/example.c - and test/minigzip.c, with more in examples/ . - - 7. Why don't you use GNU autoconf or libtool or ...? - - Because we would like to keep zlib as a very small and simple package. - zlib is rather portable and doesn't need much configuration. - - 8. I found a bug in zlib. - - Most of the time, such problems are due to an incorrect usage of zlib. - Please try to reproduce the problem with a small program and send the - corresponding source to us at zlib@gzip.org . Do not send multi-megabyte - data files without prior agreement. - - 9. Why do I get "undefined reference to gzputc"? - - If "make test" produces something like - - example.o(.text+0x154): undefined reference to `gzputc' - - check that you don't have old files libz.* in /usr/lib, /usr/local/lib or - /usr/X11R6/lib. Remove any old versions, then do "make install". - -10. I need a Delphi interface to zlib. - - See the contrib/delphi directory in the zlib distribution. - -11. Can zlib handle .zip archives? - - Not by itself, no. See the directory contrib/minizip in the zlib - distribution. - -12. Can zlib handle .Z files? - - No, sorry. You have to spawn an uncompress or gunzip subprocess, or adapt - the code of uncompress on your own. - -13. How can I make a Unix shared library? - - By default a shared (and a static) library is built for Unix. So: - - make distclean - ./configure - make - -14. How do I install a shared zlib library on Unix? - - After the above, then: - - make install - - However, many flavors of Unix come with a shared zlib already installed. - Before going to the trouble of compiling a shared version of zlib and - trying to install it, you may want to check if it's already there! If you - can #include , it's there. The -lz option will probably link to - it. You can check the version at the top of zlib.h or with the - ZLIB_VERSION symbol defined in zlib.h . - -15. I have a question about OttoPDF. - - We are not the authors of OttoPDF. The real author is on the OttoPDF web - site: Joel Hainley, jhainley@myndkryme.com. - -16. Can zlib decode Flate data in an Adobe PDF file? - - Yes. See http://www.pdflib.com/ . To modify PDF forms, see - http://sourceforge.net/projects/acroformtool/ . - -17. Why am I getting this "register_frame_info not found" error on Solaris? - - After installing zlib 1.1.4 on Solaris 2.6, running applications using zlib - generates an error such as: - - ld.so.1: rpm: fatal: relocation error: file /usr/local/lib/libz.so: - symbol __register_frame_info: referenced symbol not found - - The symbol __register_frame_info is not part of zlib, it is generated by - the C compiler (cc or gcc). You must recompile applications using zlib - which have this problem. This problem is specific to Solaris. See - http://www.sunfreeware.com for Solaris versions of zlib and applications - using zlib. - -18. Why does gzip give an error on a file I make with compress/deflate? - - The compress and deflate functions produce data in the zlib format, which - is different and incompatible with the gzip format. The gz* functions in - zlib on the other hand use the gzip format. Both the zlib and gzip formats - use the same compressed data format internally, but have different headers - and trailers around the compressed data. - -19. Ok, so why are there two different formats? - - The gzip format was designed to retain the directory information about a - single file, such as the name and last modification date. The zlib format - on the other hand was designed for in-memory and communication channel - applications, and has a much more compact header and trailer and uses a - faster integrity check than gzip. - -20. Well that's nice, but how do I make a gzip file in memory? - - You can request that deflate write the gzip format instead of the zlib - format using deflateInit2(). You can also request that inflate decode the - gzip format using inflateInit2(). Read zlib.h for more details. - -21. Is zlib thread-safe? - - Yes. However any library routines that zlib uses and any application- - provided memory allocation routines must also be thread-safe. zlib's gz* - functions use stdio library routines, and most of zlib's functions use the - library memory allocation routines by default. zlib's *Init* functions - allow for the application to provide custom memory allocation routines. - - Of course, you should only operate on any given zlib or gzip stream from a - single thread at a time. - -22. Can I use zlib in my commercial application? - - Yes. Please read the license in zlib.h. - -23. Is zlib under the GNU license? - - No. Please read the license in zlib.h. - -24. The license says that altered source versions must be "plainly marked". So - what exactly do I need to do to meet that requirement? - - You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In - particular, the final version number needs to be changed to "f", and an - identification string should be appended to ZLIB_VERSION. Version numbers - x.x.x.f are reserved for modifications to zlib by others than the zlib - maintainers. For example, if the version of the base zlib you are altering - is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and - ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also - update the version strings in deflate.c and inftrees.c. - - For altered source distributions, you should also note the origin and - nature of the changes in zlib.h, as well as in ChangeLog and README, along - with the dates of the alterations. The origin should include at least your - name (or your company's name), and an email address to contact for help or - issues with the library. - - Note that distributing a compiled zlib library along with zlib.h and - zconf.h is also a source distribution, and so you should change - ZLIB_VERSION and ZLIB_VERNUM and note the origin and nature of the changes - in zlib.h as you would for a full source distribution. - -25. Will zlib work on a big-endian or little-endian architecture, and can I - exchange compressed data between them? - - Yes and yes. - -26. Will zlib work on a 64-bit machine? - - Yes. It has been tested on 64-bit machines, and has no dependence on any - data types being limited to 32-bits in length. If you have any - difficulties, please provide a complete problem report to zlib@gzip.org - -27. Will zlib decompress data from the PKWare Data Compression Library? - - No. The PKWare DCL uses a completely different compressed data format than - does PKZIP and zlib. However, you can look in zlib's contrib/blast - directory for a possible solution to your problem. - -28. Can I access data randomly in a compressed stream? - - No, not without some preparation. If when compressing you periodically use - Z_FULL_FLUSH, carefully write all the pending data at those points, and - keep an index of those locations, then you can start decompression at those - points. You have to be careful to not use Z_FULL_FLUSH too often, since it - can significantly degrade compression. Alternatively, you can scan a - deflate stream once to generate an index, and then use that index for - random access. See examples/zran.c . - -29. Does zlib work on MVS, OS/390, CICS, etc.? - - It has in the past, but we have not heard of any recent evidence. There - were working ports of zlib 1.1.4 to MVS, but those links no longer work. - If you know of recent, successful applications of zlib on these operating - systems, please let us know. Thanks. - -30. Is there some simpler, easier to read version of inflate I can look at to - understand the deflate format? - - First off, you should read RFC 1951. Second, yes. Look in zlib's - contrib/puff directory. - -31. Does zlib infringe on any patents? - - As far as we know, no. In fact, that was originally the whole point behind - zlib. Look here for some more information: - - http://www.gzip.org/#faq11 - -32. Can zlib work with greater than 4 GB of data? - - Yes. inflate() and deflate() will process any amount of data correctly. - Each call of inflate() or deflate() is limited to input and output chunks - of the maximum value that can be stored in the compiler's "unsigned int" - type, but there is no limit to the number of chunks. Note however that the - strm.total_in and strm_total_out counters may be limited to 4 GB. These - counters are provided as a convenience and are not used internally by - inflate() or deflate(). The application can easily set up its own counters - updated after each call of inflate() or deflate() to count beyond 4 GB. - compress() and uncompress() may be limited to 4 GB, since they operate in a - single call. gzseek() and gztell() may be limited to 4 GB depending on how - zlib is compiled. See the zlibCompileFlags() function in zlib.h. - - The word "may" appears several times above since there is a 4 GB limit only - if the compiler's "long" type is 32 bits. If the compiler's "long" type is - 64 bits, then the limit is 16 exabytes. - -33. Does zlib have any security vulnerabilities? - - The only one that we are aware of is potentially in gzprintf(). If zlib is - compiled to use sprintf() or vsprintf(), then there is no protection - against a buffer overflow of an 8K string space (or other value as set by - gzbuffer()), other than the caller of gzprintf() assuring that the output - will not exceed 8K. On the other hand, if zlib is compiled to use - snprintf() or vsnprintf(), which should normally be the case, then there is - no vulnerability. The ./configure script will display warnings if an - insecure variation of sprintf() will be used by gzprintf(). Also the - zlibCompileFlags() function will return information on what variant of - sprintf() is used by gzprintf(). - - If you don't have snprintf() or vsnprintf() and would like one, you can - find a portable implementation here: - - http://www.ijs.si/software/snprintf/ - - Note that you should be using the most recent version of zlib. Versions - 1.1.3 and before were subject to a double-free vulnerability, and versions - 1.2.1 and 1.2.2 were subject to an access exception when decompressing - invalid compressed data. - -34. Is there a Java version of zlib? - - Probably what you want is to use zlib in Java. zlib is already included - as part of the Java SDK in the java.util.zip package. If you really want - a version of zlib written in the Java language, look on the zlib home - page for links: http://zlib.net/ . - -35. I get this or that compiler or source-code scanner warning when I crank it - up to maximally-pedantic. Can't you guys write proper code? - - Many years ago, we gave up attempting to avoid warnings on every compiler - in the universe. It just got to be a waste of time, and some compilers - were downright silly as well as contradicted each other. So now, we simply - make sure that the code always works. - -36. Valgrind (or some similar memory access checker) says that deflate is - performing a conditional jump that depends on an uninitialized value. - Isn't that a bug? - - No. That is intentional for performance reasons, and the output of deflate - is not affected. This only started showing up recently since zlib 1.2.x - uses malloc() by default for allocations, whereas earlier versions used - calloc(), which zeros out the allocated memory. Even though the code was - correct, versions 1.2.4 and later was changed to not stimulate these - checkers. - -37. Will zlib read the (insert any ancient or arcane format here) compressed - data format? - - Probably not. Look in the comp.compression FAQ for pointers to various - formats and associated software. - -38. How can I encrypt/decrypt zip files with zlib? - - zlib doesn't support encryption. The original PKZIP encryption is very - weak and can be broken with freely available programs. To get strong - encryption, use GnuPG, http://www.gnupg.org/ , which already includes zlib - compression. For PKZIP compatible "encryption", look at - http://www.info-zip.org/ - -39. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings? - - "gzip" is the gzip format, and "deflate" is the zlib format. They should - probably have called the second one "zlib" instead to avoid confusion with - the raw deflate compressed data format. While the HTTP 1.1 RFC 2616 - correctly points to the zlib specification in RFC 1950 for the "deflate" - transfer encoding, there have been reports of servers and browsers that - incorrectly produce or expect raw deflate data per the deflate - specification in RFC 1951, most notably Microsoft. So even though the - "deflate" transfer encoding using the zlib format would be the more - efficient approach (and in fact exactly what the zlib format was designed - for), using the "gzip" transfer encoding is probably more reliable due to - an unfortunate choice of name on the part of the HTTP 1.1 authors. - - Bottom line: use the gzip format for HTTP 1.1 encoding. - -40. Does zlib support the new "Deflate64" format introduced by PKWare? - - No. PKWare has apparently decided to keep that format proprietary, since - they have not documented it as they have previous compression formats. In - any case, the compression improvements are so modest compared to other more - modern approaches, that it's not worth the effort to implement. - -41. I'm having a problem with the zip functions in zlib, can you help? - - There are no zip functions in zlib. You are probably using minizip by - Giles Vollant, which is found in the contrib directory of zlib. It is not - part of zlib. In fact none of the stuff in contrib is part of zlib. The - files in there are not supported by the zlib authors. You need to contact - the authors of the respective contribution for help. - -42. The match.asm code in contrib is under the GNU General Public License. - Since it's part of zlib, doesn't that mean that all of zlib falls under the - GNU GPL? - - No. The files in contrib are not part of zlib. They were contributed by - other authors and are provided as a convenience to the user within the zlib - distribution. Each item in contrib has its own license. - -43. Is zlib subject to export controls? What is its ECCN? - - zlib is not subject to export controls, and so is classified as EAR99. - -44. Can you please sign these lengthy legal documents and fax them back to us - so that we can use your software in our product? - - No. Go away. Shoo. diff --git a/third-party-libs/zlib/README b/third-party-libs/zlib/README deleted file mode 100644 index 5ca9d12..0000000 --- a/third-party-libs/zlib/README +++ /dev/null @@ -1,115 +0,0 @@ -ZLIB DATA COMPRESSION LIBRARY - -zlib 1.2.8 is a general purpose data compression library. All the code is -thread safe. The data format used by the zlib library is described by RFCs -(Request for Comments) 1950 to 1952 in the files -http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and -rfc1952 (gzip format). - -All functions of the compression library are documented in the file zlib.h -(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example -of the library is given in the file test/example.c which also tests that -the library is working correctly. Another example is given in the file -test/minigzip.c. The compression library itself is composed of all source -files in the root directory. - -To compile all files and run the test program, follow the instructions given at -the top of Makefile.in. In short "./configure; make test", and if that goes -well, "make install" should work for most flavors of Unix. For Windows, use -one of the special makefiles in win32/ or contrib/vstudio/ . For VMS, use -make_vms.com. - -Questions about zlib should be sent to , or to Gilles Vollant - for the Windows DLL version. The zlib home page is -http://zlib.net/ . Before reporting a problem, please check this site to -verify that you have the latest version of zlib; otherwise get the latest -version and check whether the problem still exists or not. - -PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help. - -Mark Nelson wrote an article about zlib for the Jan. 1997 -issue of Dr. Dobb's Journal; a copy of the article is available at -http://marknelson.us/1997/01/01/zlib-engine/ . - -The changes made in version 1.2.8 are documented in the file ChangeLog. - -Unsupported third party contributions are provided in directory contrib/ . - -zlib is available in Java using the java.util.zip package, documented at -http://java.sun.com/developer/technicalArticles/Programming/compression/ . - -A Perl interface to zlib written by Paul Marquess is available -at CPAN (Comprehensive Perl Archive Network) sites, including -http://search.cpan.org/~pmqs/IO-Compress-Zlib/ . - -A Python interface to zlib written by A.M. Kuchling is -available in Python 1.5 and later versions, see -http://docs.python.org/library/zlib.html . - -zlib is built into tcl: http://wiki.tcl.tk/4610 . - -An experimental package to read and write files in .zip format, written on top -of zlib by Gilles Vollant , is available in the -contrib/minizip directory of zlib. - - -Notes for some targets: - -- For Windows DLL versions, please see win32/DLL_FAQ.txt - -- For 64-bit Irix, deflate.c must be compiled without any optimization. With - -O, one libpng test fails. The test works in 32 bit mode (with the -n32 - compiler flag). The compiler bug has been reported to SGI. - -- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works - when compiled with cc. - -- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is - necessary to get gzprintf working correctly. This is done by configure. - -- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with - other compilers. Use "make test" to check your compiler. - -- gzdopen is not supported on RISCOS or BEOS. - -- For PalmOs, see http://palmzlib.sourceforge.net/ - - -Acknowledgments: - - The deflate format used by zlib was defined by Phil Katz. The deflate and - zlib specifications were written by L. Peter Deutsch. Thanks to all the - people who reported problems and suggested various improvements in zlib; they - are too numerous to cite here. - -Copyright notice: - - (C) 1995-2013 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - -If you use the zlib library in a product, we would appreciate *not* receiving -lengthy legal documents to sign. The sources are provided for free but without -warranty of any kind. The library has been entirely written by Jean-loup -Gailly and Mark Adler; it does not include third-party code. - -If you redistribute modified sources, we would appreciate that you include in -the file ChangeLog history information documenting your changes. Please read -the FAQ for more information on the distribution of modified source versions. diff --git a/third-party-libs/zlib/lib/libz.a b/third-party-libs/zlib/lib/libz.a deleted file mode 100644 index 066bcd3..0000000 Binary files a/third-party-libs/zlib/lib/libz.a and /dev/null differ diff --git a/third-party-libs/zlib/version.txt b/third-party-libs/zlib/version.txt deleted file mode 100644 index 5975b14..0000000 --- a/third-party-libs/zlib/version.txt +++ /dev/null @@ -1 +0,0 @@ -1.2.8 \ No newline at end of file