Switching from GLEW to GLAD, WIP refactoring math library to separate built library, 'hydra'.
This commit is contained in:
9
.gitmodules
vendored
Normal file
9
.gitmodules
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
[submodule "3rdparty/glfw"]
|
||||||
|
path = 3rdparty/glfw
|
||||||
|
url = git@github.com:glfw/glfw.git
|
||||||
|
[submodule "3rdparty/glad"]
|
||||||
|
path = 3rdparty/glad
|
||||||
|
url = git@github.com:Dav1dde/glad.git
|
||||||
|
[submodule "hydra"]
|
||||||
|
path = hydra
|
||||||
|
url = git@github.com:KrakenEngine/hydra.git
|
||||||
1
3rdparty/glad
vendored
Submodule
1
3rdparty/glad
vendored
Submodule
Submodule 3rdparty/glad added at 5831fb7741
1
3rdparty/glfw
vendored
Submodule
1
3rdparty/glfw
vendored
Submodule
Submodule 3rdparty/glfw added at 23dfeee4cb
@@ -84,6 +84,30 @@ if(Boost_FOUND)
|
|||||||
target_link_libraries(kraken ${Boost_LIBRARIES})
|
target_link_libraries(kraken ${Boost_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# ---- Hydra ----
|
||||||
|
add_subdirectory(hydra)
|
||||||
|
include_directories(hydra/include)
|
||||||
|
target_link_libraries(kraken hydra)
|
||||||
|
|
||||||
|
# ---- OpenGL ----
|
||||||
|
find_package(OpenGL REQUIRED)
|
||||||
|
include_directories( ${OPENGL_INCLUDE_DIRS} )
|
||||||
|
target_link_libraries(kraken ${OPENGL_LIBRARIES})
|
||||||
|
|
||||||
|
# ---- GLAD ----
|
||||||
|
add_subdirectory(3rdparty/glad)
|
||||||
|
include_directories(${GLAD_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(kraken glad)
|
||||||
|
|
||||||
|
# ---- GLFW ----
|
||||||
|
set(GLFW_BUILD_EXAMPLES OFF CACHE INTERNAL "Build the GLFW example programs")
|
||||||
|
set(GLFW_BUILD_TESTS OFF CACHE INTERNAL "Build the GLFW test programs")
|
||||||
|
set(GLFW_BUILD_DOCS OFF CACHE INTERNAL "Build the GLFW documentation")
|
||||||
|
set(GLFW_INSTALL OFF CACHE INTERNAL "Generate installation target")
|
||||||
|
add_subdirectory(3rdparty/glfw)
|
||||||
|
include_directories(3rdparty/glfw/include)
|
||||||
|
target_link_libraries(kraken glfw ${GLFW_LIBRARIES})
|
||||||
|
|
||||||
# add_custom_target(package
|
# add_custom_target(package
|
||||||
# COMMENT "Compressing..."
|
# COMMENT "Compressing..."
|
||||||
# WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/archive"
|
# WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/archive"
|
||||||
|
|||||||
1
hydra
Submodule
1
hydra
Submodule
Submodule hydra added at 00bb9b6689
@@ -1,227 +1,227 @@
|
|||||||
//
|
//
|
||||||
// KREngine-common.h
|
// KREngine-common.h
|
||||||
// KREngine
|
// KREngine
|
||||||
//
|
//
|
||||||
// Created by Kearwood Gilbert on 12-03-15.
|
// Created by Kearwood Gilbert on 12-03-15.
|
||||||
// Copyright (c) 2012 Kearwood Software. All rights reserved.
|
// Copyright (c) 2012 Kearwood Software. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef KRENGINE_COMMON_H
|
#ifndef KRENGINE_COMMON_H
|
||||||
#define KRENGINE_COMMON_H
|
#define KRENGINE_COMMON_H
|
||||||
|
|
||||||
#include "public/kraken.h"
|
#include "public/kraken.h"
|
||||||
#include "KRHelpers.h"
|
#include "KRHelpers.h"
|
||||||
using namespace kraken;
|
using namespace kraken;
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
|
||||||
#include <stack>
|
#include <stack>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "../3rdparty/tinyxml2/tinyxml2.h"
|
#include "../3rdparty/tinyxml2/tinyxml2.h"
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
|
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
#include <AudioToolbox/AudioToolbox.h>
|
#include <AudioToolbox/AudioToolbox.h>
|
||||||
#include <AudioToolbox/AudioFile.h>
|
#include <AudioToolbox/AudioFile.h>
|
||||||
#include <AudioToolbox/ExtendedAudioFile.h>
|
#include <AudioToolbox/ExtendedAudioFile.h>
|
||||||
#include <AudioToolbox/AUGraph.h>
|
#include <AudioToolbox/AUGraph.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boost/tokenizer.hpp>
|
#include <boost/tokenizer.hpp>
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
#include <boost/signals2/mutex.hpp>
|
#include <boost/signals2/mutex.hpp>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
// _USE_MATH_DEFINES must be defined to get M_PI in Windows
|
// _USE_MATH_DEFINES must be defined to get M_PI in Windows
|
||||||
#define _USE_MATH_DEFINES
|
#define _USE_MATH_DEFINES
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::set;
|
using std::set;
|
||||||
using std::list;
|
using std::list;
|
||||||
using std::map;
|
using std::map;
|
||||||
|
|
||||||
using std::multimap;
|
using std::multimap;
|
||||||
|
|
||||||
using std::stack;
|
using std::stack;
|
||||||
using std::queue;
|
using std::queue;
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include "TargetConditionals.h"
|
#include "TargetConditionals.h"
|
||||||
#include <mach/mach.h>
|
#include <mach/mach.h>
|
||||||
#include <mach/mach_time.h>
|
#include <mach/mach_time.h>
|
||||||
#include <Accelerate/Accelerate.h>
|
#include <Accelerate/Accelerate.h>
|
||||||
#define KRAKEN_HAVE_BLAS 1
|
#define KRAKEN_HAVE_BLAS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define KRENGINE_MAX_TEXTURE_UNITS 8
|
#define KRENGINE_MAX_TEXTURE_UNITS 8
|
||||||
|
|
||||||
|
|
||||||
#if !defined(__i386__) && defined(__arm__)
|
#if !defined(__i386__) && defined(__arm__)
|
||||||
#define KRAKEN_USE_ARM_NEON
|
#define KRAKEN_USE_ARM_NEON
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
using std::unordered_map;
|
using std::unordered_map;
|
||||||
using std::unordered_multimap;
|
using std::unordered_multimap;
|
||||||
using std::hash;
|
using std::hash;
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
typedef int64_t __int64_t;
|
typedef int64_t __int64_t;
|
||||||
typedef uint64_t __uint64_t;
|
typedef uint64_t __uint64_t;
|
||||||
typedef int32_t __int32_t;
|
typedef int32_t __int32_t;
|
||||||
typedef uint32_t __uint32_t;
|
typedef uint32_t __uint32_t;
|
||||||
typedef int16_t __int16_t;
|
typedef int16_t __int16_t;
|
||||||
typedef uint16_t __uint16_t;
|
typedef uint16_t __uint16_t;
|
||||||
typedef int8_t __int8_t;
|
typedef int8_t __int8_t;
|
||||||
typedef uint8_t __uint8_t;
|
typedef uint8_t __uint8_t;
|
||||||
|
|
||||||
#include <GL/glew.h>
|
#include <glad/glad.h>
|
||||||
// OpenGL ES 2.0 mapping to OpenGL 3.2
|
// OpenGL ES 2.0 mapping to OpenGL 3.2
|
||||||
#define glDeleteQueriesEXT glDeleteQueries
|
#define glDeleteQueriesEXT glDeleteQueries
|
||||||
#define glGenQueriesEXT glGenQueries
|
#define glGenQueriesEXT glGenQueries
|
||||||
#define glBeginQueryEXT glBeginQuery
|
#define glBeginQueryEXT glBeginQuery
|
||||||
#define glEndQueryEXT glEndQuery
|
#define glEndQueryEXT glEndQuery
|
||||||
#define glGetQueryObjectuivEXT glGetQueryObjectuiv
|
#define glGetQueryObjectuivEXT glGetQueryObjectuiv
|
||||||
#define glTexStorage2DEXT glTexStorage2D
|
#define glTexStorage2DEXT glTexStorage2D
|
||||||
#define GL_ANY_SAMPLES_PASSED_EXT GL_ANY_SAMPLES_PASSED
|
#define GL_ANY_SAMPLES_PASSED_EXT GL_ANY_SAMPLES_PASSED
|
||||||
#define GL_QUERY_RESULT_EXT GL_QUERY_RESULT
|
#define GL_QUERY_RESULT_EXT GL_QUERY_RESULT
|
||||||
|
|
||||||
#elif TARGET_OS_IPHONE
|
#elif TARGET_OS_IPHONE
|
||||||
|
|
||||||
#include <OpenGLES/ES2/gl.h>
|
#include <OpenGLES/ES2/gl.h>
|
||||||
#include <OpenGLES/ES2/glext.h>
|
#include <OpenGLES/ES2/glext.h>
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <OpenGL/gl3.h>
|
#include <OpenGL/gl3.h>
|
||||||
#include <OpenGL/gl3ext.h>
|
#include <OpenGL/gl3ext.h>
|
||||||
|
|
||||||
// OpenGL ES 2.0 mapping to OpenGL 3.2
|
// OpenGL ES 2.0 mapping to OpenGL 3.2
|
||||||
#define glDepthRangef glDepthRange
|
#define glDepthRangef glDepthRange
|
||||||
#define glClearDepthf glClearDepth
|
#define glClearDepthf glClearDepth
|
||||||
#define glDeleteQueriesEXT glDeleteQueries
|
#define glDeleteQueriesEXT glDeleteQueries
|
||||||
#define glGenQueriesEXT glGenQueries
|
#define glGenQueriesEXT glGenQueries
|
||||||
#define glBeginQueryEXT glBeginQuery
|
#define glBeginQueryEXT glBeginQuery
|
||||||
#define glEndQueryEXT glEndQuery
|
#define glEndQueryEXT glEndQuery
|
||||||
#define glGetQueryObjectuivEXT glGetQueryObjectuiv
|
#define glGetQueryObjectuivEXT glGetQueryObjectuiv
|
||||||
#define glTexStorage2DEXT glTexStorage2D
|
#define glTexStorage2DEXT glTexStorage2D
|
||||||
#define GL_ANY_SAMPLES_PASSED_EXT GL_ANY_SAMPLES_PASSED
|
#define GL_ANY_SAMPLES_PASSED_EXT GL_ANY_SAMPLES_PASSED
|
||||||
#define GL_QUERY_RESULT_EXT GL_QUERY_RESULT
|
#define GL_QUERY_RESULT_EXT GL_QUERY_RESULT
|
||||||
|
|
||||||
#define GL_OES_mapbuffer 1
|
#define GL_OES_mapbuffer 1
|
||||||
#define glMapBufferOES glMapBuffer
|
#define glMapBufferOES glMapBuffer
|
||||||
#define glUnmapBufferOES glUnmapBuffer
|
#define glUnmapBufferOES glUnmapBuffer
|
||||||
#define GL_WRITE_ONLY_OES GL_WRITE_ONLY
|
#define GL_WRITE_ONLY_OES GL_WRITE_ONLY
|
||||||
|
|
||||||
#define GL_OES_vertex_array_object 1
|
#define GL_OES_vertex_array_object 1
|
||||||
#define glGenVertexArraysOES glGenVertexArrays
|
#define glGenVertexArraysOES glGenVertexArrays
|
||||||
#define glBindVertexArrayOES glBindVertexArray
|
#define glBindVertexArrayOES glBindVertexArray
|
||||||
#define glDeleteVertexArraysOES glDeleteVertexArrays
|
#define glDeleteVertexArraysOES glDeleteVertexArrays
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(DEBUG) || defined(_DEBUG)
|
#if defined(DEBUG) || defined(_DEBUG)
|
||||||
#define GLDEBUG(x) \
|
#define GLDEBUG(x) \
|
||||||
x; \
|
x; \
|
||||||
{ \
|
{ \
|
||||||
GLenum e; \
|
GLenum e; \
|
||||||
while( (e=glGetError()) != GL_NO_ERROR) \
|
while( (e=glGetError()) != GL_NO_ERROR) \
|
||||||
{ \
|
{ \
|
||||||
fprintf(stderr, "Error at line number %d, in file %s. glGetError() returned %i for call %s\n",__LINE__, __FILE__, e, #x ); \
|
fprintf(stderr, "Error at line number %d, in file %s. glGetError() returned %i for call %s\n",__LINE__, __FILE__, e, #x ); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define GLDEBUG(x) x;
|
#define GLDEBUG(x) x;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(DEBUG) || defined(_DEBUG)
|
#if defined(DEBUG) || defined(_DEBUG)
|
||||||
#define ALDEBUG(x) \
|
#define ALDEBUG(x) \
|
||||||
x; \
|
x; \
|
||||||
{ \
|
{ \
|
||||||
GLenum e; \
|
GLenum e; \
|
||||||
while( (e=alGetError()) != AL_NO_ERROR) \
|
while( (e=alGetError()) != AL_NO_ERROR) \
|
||||||
{ \
|
{ \
|
||||||
fprintf(stderr, "Error at line number %d, in file %s. alGetError() returned %i for call %s\n",__LINE__, __FILE__, e, #x ); \
|
fprintf(stderr, "Error at line number %d, in file %s. alGetError() returned %i for call %s\n",__LINE__, __FILE__, e, #x ); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define ALDEBUG(x) x;
|
#define ALDEBUG(x) x;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(DEBUG) || defined(_DEBUG)
|
#if defined(DEBUG) || defined(_DEBUG)
|
||||||
#define OSDEBUG(x) \
|
#define OSDEBUG(x) \
|
||||||
{ \
|
{ \
|
||||||
OSStatus e = x; \
|
OSStatus e = x; \
|
||||||
if( e != noErr) \
|
if( e != noErr) \
|
||||||
{ \
|
{ \
|
||||||
fprintf(stderr, "Error at line number %d, in file %s. Returned %d for call %s\n",__LINE__, __FILE__, (int)e, #x ); \
|
fprintf(stderr, "Error at line number %d, in file %s. Returned %d for call %s\n",__LINE__, __FILE__, (int)e, #x ); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define OSDEBUG(x) x;
|
#define OSDEBUG(x) x;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(GL_EXT_debug_marker) && (defined(DEBUG) || defined(_DEBUG))
|
#if defined(GL_EXT_debug_marker) && (defined(DEBUG) || defined(_DEBUG))
|
||||||
|
|
||||||
#define GL_PUSH_GROUP_MARKER(x) glPushGroupMarkerEXT(0, x)
|
#define GL_PUSH_GROUP_MARKER(x) glPushGroupMarkerEXT(0, x)
|
||||||
#define GL_POP_GROUP_MARKER glPopGroupMarkerEXT()
|
#define GL_POP_GROUP_MARKER glPopGroupMarkerEXT()
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define GL_PUSH_GROUP_MARKER(x)
|
#define GL_PUSH_GROUP_MARKER(x)
|
||||||
#define GL_POP_GROUP_MARKER
|
#define GL_POP_GROUP_MARKER
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
STREAM_LEVEL_OUT,
|
STREAM_LEVEL_OUT,
|
||||||
STREAM_LEVEL_IN_LQ,
|
STREAM_LEVEL_IN_LQ,
|
||||||
STREAM_LEVEL_IN_HQ
|
STREAM_LEVEL_IN_HQ
|
||||||
} kraken_stream_level;
|
} kraken_stream_level;
|
||||||
|
|
||||||
#include "KRBehavior.h"
|
#include "KRBehavior.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace kraken;
|
using namespace kraken;
|
||||||
|
|||||||
@@ -1,34 +1,34 @@
|
|||||||
#ifndef KRHELPERS_H
|
#ifndef KRHELPERS_H
|
||||||
#define KRHELPERS_H
|
#define KRHELPERS_H
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
#include <GL/glew.h>
|
#include <glad/glad.h>
|
||||||
#elif defined(__linux__) || defined(__unix__) || defined(__posix__)
|
#elif defined(__linux__) || defined(__unix__) || defined(__posix__)
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <GL/glu.h>
|
#include <GL/glu.h>
|
||||||
#include <GL/glext.h>
|
#include <GL/glext.h>
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
#include <OpenGL/gl3.h>
|
#include <OpenGL/gl3.h>
|
||||||
#include <OpenGL/gl3ext.h>
|
#include <OpenGL/gl3ext.h>
|
||||||
#endif
|
#endif
|
||||||
#include "../3rdparty/tinyxml2/tinyxml2.h"
|
#include "../3rdparty/tinyxml2/tinyxml2.h"
|
||||||
|
|
||||||
#define KRMIN(x,y) ((x) < (y) ? (x) : (y))
|
#define KRMIN(x,y) ((x) < (y) ? (x) : (y))
|
||||||
#define KRMAX(x,y) ((x) > (y) ? (x) : (y))
|
#define KRMAX(x,y) ((x) > (y) ? (x) : (y))
|
||||||
#define KRCLAMP(x, min, max) (KRMAX(KRMIN(x, max), min))
|
#define KRCLAMP(x, min, max) (KRMAX(KRMIN(x, max), min))
|
||||||
#define KRALIGN(x) ((x + 3) & ~0x03)
|
#define KRALIGN(x) ((x + 3) & ~0x03)
|
||||||
|
|
||||||
float const PI = 3.141592653589793f;
|
float const PI = 3.141592653589793f;
|
||||||
float const D2R = PI * 2 / 360;
|
float const D2R = PI * 2 / 360;
|
||||||
|
|
||||||
namespace kraken {
|
namespace kraken {
|
||||||
void SetUniform(GLint location, const Vector2 &v);
|
void SetUniform(GLint location, const Vector2 &v);
|
||||||
void SetUniform(GLint location, const Vector3 &v);
|
void SetUniform(GLint location, const Vector3 &v);
|
||||||
void SetUniform(GLint location, const Vector4 &v);
|
void SetUniform(GLint location, const Vector4 &v);
|
||||||
void SetUniform(GLint location, const Matrix4 &v);
|
void SetUniform(GLint location, const Matrix4 &v);
|
||||||
|
|
||||||
void setXMLAttribute(const std::string &base_name, ::tinyxml2::XMLElement *e, const Vector3 &value, const Vector3 &default_value);
|
void setXMLAttribute(const std::string &base_name, ::tinyxml2::XMLElement *e, const Vector3 &value, const Vector3 &default_value);
|
||||||
const Vector3 getXMLAttribute(const std::string &base_name, ::tinyxml2::XMLElement *e, const Vector3 &default_value);
|
const Vector3 getXMLAttribute(const std::string &base_name, ::tinyxml2::XMLElement *e, const Vector3 &default_value);
|
||||||
} // namespace kraken
|
} // namespace kraken
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user