Skip to content

Commit

Permalink
Cleaning up previous commits and making things stable.
Browse files Browse the repository at this point in the history
  • Loading branch information
tyduptyler13 committed Mar 1, 2017
1 parent 291aefe commit 200b2f7
Show file tree
Hide file tree
Showing 15 changed files with 198 additions and 113 deletions.
21 changes: 6 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
.PHONY: configure all clean fullclean compile

export CC?=clang
export CXX?=clang++


export CC=clang
export CXX=clang++

ifndef NODEBUILD
ELECTRONFLAGS=--runtime=electron --target=1.4.15 --arch=x64 --dist-url=https://atom.io/download/electron
Expand All @@ -27,13 +25,15 @@ test:

check: test

compile: configure deps/assimp/lib/libassimp.a deps/Simple-OpenGL-Image-Library/libSOIL.a
compile: configure deps/assimp/lib/libassimp.a
node-gyp build $(ELECTRONFLAGS) $(ASMJS) -- -j8

weakclean:
node-gyp clean

clean:
node-gyp clean
$(MAKE) -C deps/assimp clean
$(MAKE) -C deps/Simple-OpenGL-Image-Library clean

fullclean:
rm -rf build
Expand All @@ -48,12 +48,3 @@ deps/assimp/lib/libassimp.a: deps/assimp/Makefile

deps/assimp/CMakeLists.txt:
git submodule init deps/assimp && git submodule update deps/assimp

deps/Simple-OpenGL-Image-Library/Makefile: deps/Simple-OpenGL-Image-Library/CMakeLists.txt
cd deps/Simple-OpenGL-Image-Library && $(PRECMAKE) cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-fpic -DCMAKE_C_FLAGS=-fpic $(SOILCMAKEFLAGS)

deps/Simple-OpenGL-Image-Library/libSOIL.a: deps/Simple-OpenGL-Image-Library/Makefile
$(MAKE) -C deps/Simple-OpenGL-Image-Library

deps/Simple-OpenGL-Image-Library/CMakeLists.txt:
git submodule init deps/Simple-OpenGL-Image-Library && git submodule update deps/Simple-OpenGL-Image-Library
14 changes: 13 additions & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
'src/nbind/Geometry.cpp',
'src/nbind/Materials/GLES2NormalMaterial.cpp'
],
'dependencies': [ 'build.gyp:libMyEngine' ],
'dependencies': [ 'build.gyp:MyEngine' ],
'cflags': [
'-std=c++14',
'-fpic'
Expand All @@ -46,6 +46,18 @@
],
'includes': [
'node_modules/nbind/src/nbind.gypi'
],
"conditions": [
['OS=="win"', {
"msvs_settings": {
"VCCLCompilerTool": {
"AdditionalOptions": [
"/GR",
"/EHsc"
]
}
}
}]
]
}
]
Expand Down
112 changes: 98 additions & 14 deletions build.gyp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"targets": [
{
"target_name": "libMyEngine",
"target_name": "MyEngine",
"type": "static_library",
"sources": [
"src/Material.cpp",
Expand All @@ -22,6 +22,10 @@
"deps/assimp/include"
#glfw is expected to be installed on each system target
],
"dependencies": [
"glsl-optimizer",
"SOIL"
],
"direct_dependent_settings": {
"include_dirs": [
"include",
Expand All @@ -31,41 +35,65 @@
},
"link_dependent_settings": {
"dependencies": [
"glsl-optimizer"
]
},
"link_settings": {
"libraries": [
"../deps/Simple-OpenGL-Image-Library/libSOIL.a",
"../deps/assimp/lib/libassimp.a",
"-lGLESv2"
"glsl-optimizer",
"SOIL"
]
},
"variables": {
"asmjs%": "0"
},
"conditions": [
['OS=="win"', {
"direct_dependent_settings": {
"include_dirs": [
"include/Graphics",
"deps/glfw/include"
]
},
"include_dirs": [
"include/Graphics",
"deps/glfw/include"
],
"link_settings": {
"libraries": [
"../lib/assimp.lib",
"../lib/glfw3.lib",
"../lib/libGLESv2.lib",
"-lgdi32",
"-lopengl32"
],
"libraries!": [
"-lGLESv2",
"-lglfw3"
]
},
"msvs_settings": {
"VCCLCompilerTool": {
"AdditionalOptions": [
"/GR",
"/MD",
"/EHsc"
]
}
}
}],
['OS=="linux"', {
"conditions": [
['asmjs==1', {
"link_settings": {
"libraries": [
"../deps/assimp/lib/libassimp.a",
"-lGLESv2",
"-s USE_GLFW=3",
"-lglfw3",
"../deps/assimp/lib/libzlibstatic.a"
"../deps/assimp/lib/libzlibstatic.a" #last for a reason
]
}
}, {
"link_settings": {
"libraries": [
"../deps/assimp/lib/libassimp.a",
"-lGLESv2",
"<!(pkg-config glfw3 --static --libs-only-l)",
"-pthread" #We might need pthread for gcc (because their std::threads are broken otherwise)
]
Expand All @@ -74,9 +102,6 @@
]
}]
],
"dependencies": [
"glsl-optimizer"
],
"ldflags": [ "-L../lib" ],
"cflags": [
"-Wall",
Expand Down Expand Up @@ -236,7 +261,66 @@
"include_dirs": [
"deps/glsl-optimizer/src"
]
}
},
"conditions": [
['OS=="win"', {
"msvs_settings": {
"VCCLCompilerTool": {
"AdditionalOptions": [
"/GR",
"/EHsc"
]
}
}
}]
]
},
{
"target_name": "SOIL",
"type": "static_library",
"variables": {
"root": "deps/Simple-OpenGL-Image-Library"
},
"include_dirs": [
"<(root)/src"
],
"sources": [
"<(root)/src/image_DXT.c",
"<(root)/src/image_helper.c",
"<(root)/src/SOIL.c",
"<(root)/src/stb_image_aug.c"
],
"cflags!": [
'-fno-exceptions'
],
"cflags": [
"-fpic"
],
'cflags_cc!': [
'-fno-exceptions',
'-fno-rtti',
'-std=gnu++0x'
],
'cflags_cc': [
'-std=c++11'
],
"direct_dependent_settings": {
"include_dirs": [
"<(root)/src"
]
},
"conditions": [
['OS=="win"', {
"msvs_settings": {
"VCCLCompilerTool": {
"AdditionalOptions": [
"/GR",
"/EHsc"
]
}
}
}]
]
}
]
}
2 changes: 1 addition & 1 deletion deps/glfw
Submodule glfw updated 61 files
+17 −8 .github/CONTRIBUTING.md
+7 −0 CMake/modules/FindVulkan.cmake
+4 −0 CMakeLists.txt
+49 −10 README.md
+1 −1 deps/linmath.h
+490 −207 deps/nuklear.h
+2 −2 deps/nuklear_glfw_gl2.h
+1 −1 deps/vulkan/vk_platform.h
+647 −7 deps/vulkan/vulkan.h
+3 −1 docs/CMakeLists.txt
+6 −3 docs/build.dox
+8 −3 docs/compat.dox
+23 −6 docs/input.dox
+9 −3 docs/intro.dox
+7 −0 docs/moving.dox
+13 −0 docs/news.dox
+5 −5 docs/vulkan.dox
+54 −18 docs/window.dox
+5 −2 examples/CMakeLists.txt
+55 −29 include/GLFW/glfw3.h
+1 −0 include/GLFW/glfw3native.h
+14 −7 src/CMakeLists.txt
+6 −13 src/cocoa_joystick.h
+208 −326 src/cocoa_joystick.m
+8 −3 src/cocoa_monitor.m
+23 −25 src/cocoa_window.m
+0 −1 src/context.c
+40 −39 src/init.c
+86 −8 src/input.c
+85 −40 src/internal.h
+83 −138 src/linux_joystick.c
+5 −15 src/linux_joystick.h
+1 −2 src/mir_init.c
+6 −0 src/monitor.c
+12 −0 src/nsgl_context.m
+38 −0 src/null_joystick.c
+34 −0 src/null_joystick.h
+4 −4 src/osmesa_context.h
+1 −1 src/osmesa_platform.h
+0 −20 src/osmesa_window.c
+15 −4 src/vulkan.c
+22 −23 src/wgl_context.c
+42 −8 src/win32_init.c
+175 −235 src/win32_joystick.c
+3 −8 src/win32_joystick.h
+36 −15 src/win32_monitor.c
+12 −8 src/win32_platform.h
+1 −1 src/win32_time.c
+2 −2 src/win32_tls.c
+161 −91 src/win32_window.c
+31 −19 src/window.c
+1 −2 src/wl_init.c
+2 −0 src/wl_window.c
+32 −2 src/x11_init.c
+8 −5 src/x11_monitor.c
+25 −1 src/x11_platform.h
+96 −16 src/x11_window.c
+7 −3 tests/CMakeLists.txt
+0 −2 tests/gamma.c
+1 −1 tests/glfwinfo.c
+1 −6 tests/joysticks.c
10 changes: 6 additions & 4 deletions include/GLFWManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ namespace MyUPlay {
glfwInit();
glfwLog.log("Initialized");
glfwSetErrorCallback(errorCallback);

//Event systems
init();

}

instances++;
Expand All @@ -49,8 +45,14 @@ namespace MyUPlay {
}

window = glfwCreateWindow(width, height, title, mon, manager ? manager->window : nullptr);

if (window == nullptr) throw std::runtime_error("Failed to create GLFW window!");

glfwLog.log("Created window");

//Event systems
init();

}

~GLFWManager(){
Expand Down
12 changes: 10 additions & 2 deletions include/Geometries/SphereGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ namespace MyUPlay {
template <typename T>
struct SphereGeometry : public BufferGeometry<T> {

SphereGeometry(T radius = 50, unsigned widthSegments = 8, unsigned heightSegments = 6,
T phiStart = 0, T phiLength = Math::PI * 2, T thetaStart = 0, T thetaLength = Math::PI){
SphereGeometry(T radius, unsigned widthSegments, unsigned heightSegments,
T phiStart, T phiLength = Math::PI * 2, T thetaStart = 0, T thetaLength = Math::PI){

widthSegments = Math::max(3, widthSegments);
heightSegments = Math::max(2, heightSegments);
Expand Down Expand Up @@ -70,8 +70,16 @@ namespace MyUPlay {
}
}

this->indicesNeedUpdate = true;

}

//Explicit constructors for js bindings.

SphereGeometry(T radius, unsigned widthSegments, unsigned heightSegments = 6) : SphereGeometry(radius, widthSegments, heightSegments, 0) {}

SphereGeometry(T radius) : SphereGeometry(radius, 8) {}

SphereGeometry(const SphereGeometry& s) : BufferGeometry<T>(s) {}

};
Expand Down
6 changes: 5 additions & 1 deletion include/GeometryImporter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ namespace MyUPlay {
*/
static Object3D<float>* ImportAsset(std::string, bool raw = false, std::string ext = "");

static std::shared_ptr<Object3D<float>> ImportSharedAsset(std::string s, bool raw = false, std::string ext = "") {
static std::shared_ptr<Object3D<float>> ImportSharedAsset(std::string s, bool raw, std::string ext = "") {
return std::shared_ptr<Object3D<float>>(ImportAsset(s, raw, ext));
}

static std::shared_ptr<Object3D<float>> ImportSharedAsset(std::string s) {
return std::shared_ptr<Object3D<float>>(ImportAsset(s));
}

};
}
}
Expand Down
7 changes: 5 additions & 2 deletions include/Shader/ShaderUtil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ namespace MyUPlay {
* T - Type for conversion to some shading language.
* @return A renderer specific type related to a c type.
*/
template <typename R, typename T>
template <class R, typename T>
const char* type;

//Only clang seems to properly support these, they aren't needed but supress warnings.
#ifdef __clang__
//Specializations for shaders (Allows a renderer to work)
template<> extern const char* type<GLES2Renderer, bool>;
template<> extern const char* type<GLES2Renderer, int>;
Expand All @@ -52,13 +54,14 @@ namespace MyUPlay {
template<> extern const char* type<GLES2Renderer, Matrix3<float>>;
template<> extern const char* type<GLES2Renderer, Matrix4<float>>;
template<> extern const char* type<GLES2Renderer, Texture>;
#endif

/**
* R - Renderer
* T - Type for conversion to some shading language.
* @return A renderer specific type related to a c type.
*/
template <typename R, typename T>
template <class R, typename T>
std::string toString(const T& t){
return std::to_string(t); //Default fallback
}
Expand Down
Loading

0 comments on commit 200b2f7

Please sign in to comment.