Permalink
Browse files

Merge `const-everything` into master

  • Loading branch information...
MattRyder committed Jul 8, 2018
1 parent 6f0f496 commit 07fd2da60a72d133034341fcc7d952171f741489
Showing with 15,354 additions and 7,485 deletions.
  1. +1 −0 .gitignore
  2. +8 −13 .travis.yml
  3. BIN Assets/Fonts/ionicons.ttf
  4. BIN Assets/Models/default/box/ao.png
  5. +2 −4 Assets/Models/default/box/box.mtl
  6. +1 −1 Assets/Models/default/box/box.obj
  7. BIN Assets/Models/default/box/diffuse.png
  8. BIN Assets/Models/default/box/displacement.png
  9. BIN Assets/Models/default/box/normal.png
  10. BIN Assets/Models/default/box/specular.png
  11. +1 −1 Assets/Shaders/300_es/deferred_geometry_fs.glsl
  12. +2 −2 Assets/Shaders/300_es/deferred_lighting_fs.glsl
  13. +49 −0 Assets/Shaders/420/ambient_occlusion_fs.glsl
  14. +23 −0 Assets/Shaders/420/ambient_occlusion_vs.glsl
  15. +3 −3 Assets/Shaders/420/deferred_geometry_fs.glsl
  16. +6 −4 Assets/Shaders/420/deferred_lighting_fs.glsl
  17. +7 −33 CMakeLists.txt
  18. +4 −5 Editor/include/Editor.h
  19. +741 −0 Editor/include/Ionicons.h
  20. +8 −10 Editor/include/components/ContentBrowser.h
  21. +13 −9 Editor/include/components/Dock.h
  22. +26 −83 Editor/include/components/EntityInspector.h
  23. +1 −0 Editor/include/components/IComponent.h
  24. +4 −4 Editor/include/components/Menubar.h
  25. +31 −71 Editor/src/Editor.cpp
  26. +13 −7 Editor/src/Main.cpp
  27. +9 −25 Editor/src/components/ContentBrowser.cpp
  28. +67 −75 Editor/src/components/Dock.cpp
  29. +13 −7 Editor/src/components/Menubar.cpp
  30. +33 −18 Editor/thirdparty/imgui/imconfig.h
  31. +6,251 −2,711 Editor/thirdparty/imgui/imgui.cpp
  32. +958 −512 Editor/thirdparty/imgui/imgui.h
  33. +1,166 −594 Editor/thirdparty/imgui/imgui_demo.cpp
  34. +2 −2 Editor/thirdparty/imgui/imgui_dock.cpp
  35. +945 −368 Editor/thirdparty/imgui/imgui_draw.cpp
  36. +216 −83 Editor/thirdparty/imgui/imgui_impl_glfw_gl3.cpp
  37. +12 −6 Editor/thirdparty/imgui/imgui_impl_glfw_gl3.h
  38. +606 −223 Editor/thirdparty/imgui/imgui_internal.h
  39. +81 −31 Editor/thirdparty/imgui/stb_rect_pack.h
  40. +41 −39 Editor/thirdparty/imgui/stb_textedit.h
  41. +1,701 −110 Editor/thirdparty/imgui/stb_truetype.h
  42. +62 −68 Engine/CMakeLists.txt
  43. +130 −0 Engine/include/BaseEntity.h
  44. +6 −27 Engine/include/CameraBase.h
  45. +0 −56 Engine/include/Entity.h
  46. +13 −18 Engine/include/FreeCamera.h
  47. +12 −10 Engine/include/Game.h
  48. +33 −0 Engine/include/IEntity.h
  49. +3 −5 Engine/include/LightBase.h
  50. +0 −1 Engine/include/Logger.h
  51. +3 −4 Engine/include/Mesh.h
  52. +9 −4 Engine/include/MeshService.h
  53. +7 −5 Engine/include/Skybox.h
  54. +5 −1 Engine/include/Texture.h
  55. +19 −0 Engine/include/event/BaseEvent.h
  56. +45 −0 Engine/include/event/EventManager.h
  57. +42 −0 Engine/include/event/IEvent.h
  58. +58 −0 Engine/include/event/InputEvents.h
  59. +15 −0 Engine/include/event/OnTickEvent.h
  60. +1 −2 Engine/include/glfw/glfw_callback.h
  61. +0 −3 Engine/include/input/Controller.h
  62. +5 −25 Engine/include/input/InputManager.h
  63. +4 −0 Engine/include/renderer/DeferredLightingPass.h
  64. +1 −2 Engine/include/renderer/Framebuffer.h
  65. +4 −5 Engine/include/renderer/Pipeline.h
  66. +12 −0 Engine/include/renderer/RenderPass.h
  67. +0 −17 Engine/include/renderer/RenderPassType.h
  68. +31 −0 Engine/include/renderer/SsaoPass.h
  69. +2 −3 Engine/include/renderer/UniformBufferManager.h
  70. +6 −3 Engine/include/renderer/api/GL420.h
  71. +4 −2 Engine/include/renderer/api/GLES3.h
  72. +11 −5 Engine/include/renderer/api/IGraphicsApi.h
  73. +0 −90 Engine/include/scene/Node.h
  74. +13 −17 Engine/include/scene/VisibleSet.h
  75. +10 −12 Engine/include/world/Database.h
  76. +262 −0 Engine/src/BaseEntity.cpp
  77. +6 −10 Engine/src/CameraBase.cpp
  78. +0 −68 Engine/src/Entity.cpp
  79. +28 −47 Engine/src/FreeCamera.cpp
  80. +76 −92 Engine/src/Game.cpp
  81. +3 −10 Engine/src/LightBase.cpp
  82. +8 −3 Engine/src/Mesh.cpp
  83. +52 −43 Engine/src/MeshService.cpp
  84. +1 −1 Engine/src/PointLight.cpp
  85. +18 −11 Engine/src/Skybox.cpp
  86. +13 −0 Engine/src/event/BaseEvent.cpp
  87. +71 −0 Engine/src/event/EventManager.cpp
  88. +3 −12 Engine/src/glfw/glfw_callback.cpp
  89. +23 −27 Engine/src/input/Controller.cpp
  90. +41 −79 Engine/src/input/InputManager.cpp
  91. +1 −2 Engine/src/renderer/DeferredGeometryPass.cpp
  92. +20 −4 Engine/src/renderer/DeferredLightingPass.cpp
  93. +1 −1 Engine/src/renderer/ForwardRenderPass.cpp
  94. +1 −12 Engine/src/renderer/Framebuffer.cpp
  95. +36 −19 Engine/src/renderer/Pipeline.cpp
  96. +18 −19 Engine/src/renderer/RenderPass.cpp
  97. +9 −5 Engine/src/renderer/SkyboxRenderPass.cpp
  98. +130 −0 Engine/src/renderer/SsaoPass.cpp
  99. +1 −1 Engine/src/renderer/UniformBufferManager.cpp
  100. +117 −46 Engine/src/renderer/api/GL420.cpp
  101. +8 −3 Engine/src/renderer/api/GLES3.cpp
  102. +0 −178 Engine/src/scene/Node.cpp
  103. +49 −33 Engine/src/scene/VisibleSet.cpp
  104. +2 −1 Engine/src/sqlite3pp/sqlite3pp.cpp
  105. +1 −1 Engine/src/sqlite3pp/sqlite3ppext.cpp
  106. +459 −458 Engine/src/world/Database.cpp
  107. +13 −68 Tests/CMakeLists.txt
  108. +4 −5 Tests/include/EntityTest.h
  109. +9 −9 Tests/include/FreeCameraTest.h
  110. +3 −2 Tests/include/LightBaseTest.h
  111. +0 −5 Tests/include/Main.h
  112. +0 −23 Tests/include/SceneNodeTest.h
  113. +8 −6 Tests/include/mocks/MockGraphicsApi.h
  114. +17 −21 Tests/src/AABBTest.cpp
  115. +6 −4 Tests/src/EntityTest.cpp
  116. +8 −2 Tests/src/FreeCameraTest.cpp
  117. +13 −13 Tests/src/InputManagerTest.cpp
  118. +0 −7 Tests/src/Main.cpp
  119. +3 −3 Tests/src/MeshServiceTest.cpp
  120. +0 −58 Tests/src/SceneNodeTest.cpp
  121. +143 −143 Tests/src/WorldDatabaseTest.cpp
  122. +16 −5 appveyor.yml
  123. +0 −107 cmake/FindAssimp.cmake
  124. +0 −22 cmake/FindCxxopts.cmake
  125. +0 −82 cmake/FindGTK3.cmake
  126. +0 −116 cmake/FindGlfw.cmake
  127. +0 −71 cmake/FindGlm.cmake
  128. +0 −26 cmake/FindJson11.cmake
  129. +0 −21 cmake/FindSpdlog.cmake
  130. +0 −41 cmake/FindSqlite3.cmake
  131. +42 −0 travis-install.sh
@@ -10,6 +10,7 @@ CTestTestfile.cmake

.vs
.vscode
CMakeSettings.json

build/
Assets/Models
@@ -5,25 +5,20 @@ dist: trusty
addons:
apt:
sources:
- ubuntu-toolchain-r-test # gcc-5
- george-edison55-precise-backports # cmake 3.2.3
- ubuntu-toolchain-r-test # gcc-8
packages:
- g++-5
- gcc-5
- cmake
- cmake-data
- g++-8
- gcc-8
- xorg-dev
- libglu1-mesa-dev
- libgtk-3-dev
- libassimp-dev
- libglm-dev

install:
- sudo ./travis-install.sh

script:
- sudo unlink /usr/bin/g++ && sudo ln -s /usr/bin/g++-5 /usr/bin/g++
- g++ --version
- mkdir build
- cd build
- cmake .. -DBUILD_TESTS=ON
- cmake .. -DBUILD_TESTS=ON -DCMAKE_TOOLCHAIN_FILE=/home/travis/vcpkg/scripts/buildsystems/vcpkg.cmake
- make
- cd Debug/
- ./GibTest
- ./Tests/GibTest
Binary file not shown.
Binary file not shown.
@@ -13,7 +13,5 @@ newmtl 01___Default
Ks 0.0720 0.0720 0.0720
Ke 0.0000 0.0000 0.0000
map_Kd diffuse.png
map_Ks specular.png
bump normal.png
disp -mm -.95 .02 displacement.png

map_Bump normal.png
map_Ks specular.png
@@ -31,7 +31,7 @@ vt 0.0000 0.0000 0.0000
vt 1.0000 0.0000 0.0000
# 4 texture coords

g Box01
g Stock Cube
usemtl 01___Default
s 2
f 1/1/1 2/2/1 3/3/1 4/4/1
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -30,7 +30,7 @@ uniform sampler2D texture_normal0;
uniform sampler2D texture_depth0;

const float Z_NEAR = 1.0;
const float Z_FAR = 250.0;
const float Z_FAR = 2000.0;

float linearDepth(float depthValue) {
// translate to normalized device coordinate space:
@@ -36,14 +36,14 @@ void main() {
for(int i = 0; i < LIGHT_COUNT; i++) {
float distanceToLight = length(pointLights[i].position - fragmentPosition);

if(distanceToLight > pointLights[i].volumeRadius * 10.0)
if(distanceToLight > pointLights[i].volumeRadius * 100)
continue;

vec3 lightDirection = normalize(pointLights[i].position - fragmentPosition);
vec3 diffuseColor = max(dot(fragmentNormal, lightDirection), 0.0) * fragmentDiffuse * pointLights[i].diffuseColor;

vec3 halfwayDirection = normalize(lightDirection + viewDirection);
float specularComponent = pow(max(dot(fragmentNormal, halfwayDirection), 0.0), 2.0);
float specularComponent = pow(max(dot(fragmentNormal, halfwayDirection), 0.0), 16.0);
vec3 specularColor = pointLights[i].specularColor * specularComponent * fragmentSpecular;

float attenuation = 1.0 / (1.0 + pointLights[i].linearAttenuation * distanceToLight + pointLights[i].quadraticAttenuation * pow(distanceToLight, 2.0));
@@ -0,0 +1,49 @@
#version 420

layout(binding = 0) uniform sampler2D texture_Position;
layout(binding = 1) uniform sampler2D texture_Normal;
layout(binding = 2) uniform sampler2D texture_Noise;

const int KERNEL_SIZE = 64;
uniform vec3 ssao_Kernel[KERNEL_SIZE];

const vec2 noiseScale = vec2(1920.0 / 4.0, 1080.0 / 4.0);

in VertexShader {
mat4 ViewMatrix;
mat4 ProjectionMatrix;
vec2 TexCoords;
} VS;

out float fragColor;

void main() {
vec3 ssaoPos = texture(texture_Position, VS.TexCoords).xyz;
vec3 ssaoNormal = normalize(texture(texture_Normal, VS.TexCoords).rgb);
vec3 ssaoNoise = normalize(texture(texture_Noise, VS.TexCoords * noiseScale).xyz);

vec3 tangent = normalize(ssaoNoise - ssaoNormal * dot(ssaoNoise, ssaoNormal));
vec3 bitangent = cross(ssaoNormal, tangent);
mat3 tbnMatrix = mat3(tangent, bitangent, ssaoNormal);

float occlusionRadius = 0.25;
float occlusion = 0.0;
for(int i = 0; i < KERNEL_SIZE; i++) {
vec3 ssaoSample = tbnMatrix * ssao_Kernel[i];
ssaoSample = ssaoPos + ssaoSample * occlusionRadius;

vec4 offset = vec4(ssaoSample, 1.0);
offset = VS.ProjectionMatrix * VS.ViewMatrix * offset;
offset.xyz /= offset.w; // perspective divide
offset.xyz = offset.xyz * 0.5 + 0.5;

// read depth from position sampler
float sampleDepth = texture(texture_Position, offset.xy).z;
float rangeCheck = smoothstep(0.0, 1.0, length(ssaoPos.z - sampleDepth) / occlusionRadius);
occlusion += (sampleDepth >= ssaoSample.z + 0.025 ? 1.0 : 0.0) * rangeCheck;
}


occlusion = 1.0 - (occlusion / KERNEL_SIZE);
fragColor = occlusion;
}
@@ -0,0 +1,23 @@
#version 420

layout(location = 0) in vec3 v_Position;
layout(location = 2) in vec2 v_TexCoords;

layout (std140) uniform cameraUBO {
mat4 ProjectionMatrix;
mat4 ViewMatrix;
};

out VertexShader {
mat4 ViewMatrix;
mat4 ProjectionMatrix;
vec2 TexCoords;
} VS;

void main() {
VS.ViewMatrix = ViewMatrix;
VS.ProjectionMatrix = ProjectionMatrix;
VS.TexCoords = v_TexCoords;

gl_Position = vec4(v_Position, 1.0);
}
@@ -36,7 +36,7 @@ uniform sampler2D texture_depth0;
uniform Material material;

const float Z_NEAR = 1.0;
const float Z_FAR = 2500.0;
const float Z_FAR = 2000.0;

float linearDepth(float depthValue) {
// translate to normalized device coordinate space:
@@ -46,8 +46,8 @@ float linearDepth(float depthValue) {

void main() {
g_Position = vec4(VS.FragmentPosition, 1.0);
g_Position.a = linearDepth(gl_FragCoord.z),
g_Position.a = linearDepth(gl_FragCoord.z);
g_Normal = normalize(texture(texture_normal0, VS.TexCoords).rgb);
g_Albedo.rgb = material.diffuseColor + texture(texture_diffuse0, VS.TexCoords).rgb;
g_Albedo.rgb = /*material.diffuseColor +*/ texture(texture_diffuse0, VS.TexCoords).rgb;
g_Albedo.a = texture(texture_specular0, VS.TexCoords).r;
}
@@ -15,6 +15,7 @@ struct Light {
layout(binding = 0) uniform sampler2D framebuffer_Position;
layout(binding = 1) uniform sampler2D framebuffer_Albedo;
layout(binding = 2) uniform sampler2D framebuffer_Normal;
layout(binding = 3) uniform sampler2D framebuffer_SSAO;

uniform int pointLightCount;
uniform Light pointLights[MAX_LIGHT_COUNT];
@@ -31,16 +32,17 @@ void main() {
vec3 fragmentPosition = texture(framebuffer_Position, VS.TexCoords).rgb;
vec3 fragmentNormal = texture(framebuffer_Normal, VS.TexCoords).rgb;
float fragmentSpecular = texture(framebuffer_Albedo, VS.TexCoords).a;
float fragmentSSAO = texture(framebuffer_SSAO, VS.TexCoords).r;

vec3 lightColor = fragmentDiffuse * 0.25;
vec3 lightColor = fragmentDiffuse * 0.666 * fragmentSSAO;
vec3 viewDirection = normalize(VS.CameraPosition - fragmentPosition);

for(int i = 0; i < pointLightCount; i++) {
float distanceToLight = length(pointLights[i].position - fragmentPosition);

// This is really convenient right now. Delet later.
if(distanceToLight > pointLights[i].volumeRadius * pointLights[i].linearAttenuation)
continue;
if(distanceToLight > pointLights[i].volumeRadius)
continue;

vec3 lightDirection = normalize(pointLights[i].position - fragmentPosition);
vec3 diffuseColor = max(dot(fragmentNormal, lightDirection), 0.0) * fragmentDiffuse * pointLights[i].diffuseColor;
@@ -49,7 +51,7 @@ void main() {
float specularComponent = pow(max(dot(fragmentNormal, halfwayDirection), 0.0), 16.0);
vec3 specularColor = pointLights[i].specularColor * specularComponent * fragmentSpecular;

float attenuation = 1.0 / (1.0 + /*pointLights[i].linearAttenuation*/ 0.1 * distanceToLight + /*pointLights[i].quadraticAttenuation*/ 0.01 * pow(distanceToLight, 2));
float attenuation = 1.0 / (1.0 + /*pointLights[i].linearAttenuation*/ 0.5 * distanceToLight + pointLights[i].quadraticAttenuation * pow(distanceToLight, 2));

diffuseColor *= attenuation;
specularColor *= attenuation;
@@ -1,47 +1,21 @@
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
cmake_minimum_required(VERSION 3.7 FATAL_ERROR)
project(GibEngine C CXX)

set(CC gcc)
set(CXX clang)

# Enable C++11 support
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED on)

list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")

# Required to gen. symbols for GDB
set(CMAKE_BUILD_TYPE Debug)

# It should be building in an env directory, like MSVC, on unix
if(UNIX)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}")
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)

option(BUILD_EDITOR "Builds the GibEditor" ON)
option(BUILD_TESTS "Build the test suite" ON)

include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/include)

set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/build)

set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})

set(PROJECT_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)

include_directories("${PROJECT_INCLUDE_DIR}")
include_directories("${PROJECT_SOURCE_DIR}")
include_directories("${CMAKE_CURRENT_BINARY_DIR}/include")

add_subdirectory(Engine/)

if(BUILD_EDITOR)
add_subdirectory(Editor/)
endif()
#if(BUILD_EDITOR)
# add_subdirectory(Editor/)
#endif()

#if(BUILD_TESTS)
enable_testing()
add_subdirectory(Tests/)
add_subdirectory(Tests/)
#endif()
@@ -16,7 +16,6 @@ namespace GibEditor
{
public:
Editor(int argc, char** argv);
~Editor();

enum Flags
{
@@ -27,15 +26,15 @@ namespace GibEditor
virtual void Render() override;
virtual void Update() override;

Components::Dock* GetDock() const;
std::shared_ptr<Components::Dock> GetDock() const;

static bool FlagMask(Flags x) { return static_cast<char>(x) != 0; };

private:
Flags flags = Flags::DEFAULT;
Components::Menubar* menubar;
Components::Dock* dock;
Components::StatusBar* statusBar;
std::shared_ptr<Components::Menubar> menubar;
std::shared_ptr<Components::StatusBar> statusBar;
std::shared_ptr<Components::Dock> dock;

float keydownInterval = 0;
float deltaDisplayIntervalTimer;
Oops, something went wrong.

0 comments on commit 07fd2da

Please sign in to comment.