Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .idea/EdisonEngine.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion 3rdparty/rapidyaml
Submodule rapidyaml updated 183 files
2 changes: 1 addition & 1 deletion cmake/get_cimg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ endif()

include( ./dl_unpack )

set( _cimg_version "v.3.4.3" )
set( _cimg_version "v.3.5.3" )
dl_unpack(
URL https://github.com/GreycLab/CImg/archive/${_cimg_version}.tar.gz
FILENAME CImg-${_cimg_version}.tar.gz
Expand Down
2 changes: 1 addition & 1 deletion cmake/get_glm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ dl_unpack(

add_library( glm::glm INTERFACE IMPORTED )
target_include_directories( glm::glm SYSTEM BEFORE INTERFACE "${EXTERNAL_SRC_ROOT}/glm-${_glm_version}" )
target_compile_definitions( glm::glm INTERFACE -DGLM_ENABLE_EXPERIMENTAL )
target_compile_definitions( glm::glm INTERFACE -DGLM_ENABLE_EXPERIMENTAL -DGLM_FORCE_SSE42 -DGLM_FORCE_CXX${CMAKE_CXX_STANDARD} )
6 changes: 4 additions & 2 deletions cmake/get_gsllite.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ endif()

include( ./dl_unpack )

set( _gsl_lite_version "0.42.0" )
set( _gsl_lite_version "1.0.1" )
dl_unpack(
URL https://github.com/gsl-lite/gsl-lite/archive/refs/tags/v${_gsl_lite_version}.tar.gz
FILENAME gsl-lite-v${_gsl_lite_version}.tar.gz
Expand All @@ -19,6 +19,8 @@ target_compile_definitions(
-Dgsl_FEATURE_MAKE_SPAN_TO_STD=${CMAKE_CXX_STANDARD}
-Dgsl_FEATURE_BYTE_SPAN_TO_STD=${CMAKE_CXX_STANDARD}
-Dgsl_CONFIG_NOT_NULL_EXPLICIT_CTOR=1
-Dgsl_CONFIG_TRANSPARENT_NOT_NULL=0
-Dgsl_CONFIG_CONTRACT_VIOLATION_CALLS_HANDLER
-Dgsl_CPLUSPLUS=201703L
-Dgsl_CONFIG_DEFAULTS_VERSION=1
-Dgsl_CPLUSPLUS=202002L
)
2 changes: 1 addition & 1 deletion cmake/get_valvefilevdf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ endif()
include( ./dl_unpack )

add_library( valve-file-vdf::valve-file-vdf INTERFACE IMPORTED )
target_include_directories( valve-file-vdf::valve-file-vdf INTERFACE "${EXTERNAL_SRC_ROOT}/ValveFileVDF" )
target_include_directories( valve-file-vdf::valve-file-vdf INTERFACE "${EXTERNAL_SRC_ROOT}/ValveFileVDF/include" )
4 changes: 2 additions & 2 deletions cmake/scripts/wrap_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def generate_header_lines(args, enums: List[Tuple[str, str]]) -> Iterable[str]:
yield "#pragma once"
yield ""
yield "#include <cstdint>"
yield "#include <gsl/gsl-lite.hpp>"
yield "#include <gsl-lite/gsl-lite.hpp>"
yield "#include <map>"
yield "#include <string>"
for include in args.with_includes:
Expand Down Expand Up @@ -66,7 +66,7 @@ def generate_impl_lines(args, enums: List[Tuple[str, str]], include_path: Path)
yield f"#include \"{include_path.as_posix()}\""
yield ""
yield "#include <cstdint>"
yield "#include <gsl/gsl-lite.hpp>"
yield "#include <gsl-lite/gsl-lite.hpp>"
yield "#include <map>"
yield "#include <stdexcept>"
yield "#include <string>"
Expand Down
2 changes: 1 addition & 1 deletion cmake/toolchain_config.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_STANDARD 20 )
set( CMAKE_CXX_STANDARD_REQUIRED ON )

include( CheckPIESupported )
Expand Down
1 change: 1 addition & 0 deletions deprecations.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
CE-675 2.8 Remove doppelganger save migration
CE-378 2.9 Remove CameraController save migrations
9 changes: 7 additions & 2 deletions dev-docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ the prior level ends during the stats screen.
First, the engine initializes the script engine for the chosen game-flow. Then, the engine sets up a `Presenter`, which
basically is a container around everything a user can sense - audio and video currently, but may also include gamepad
rumble effects in the future once it's implemented in GLFW (blocked
by [issue #57](https://github.com/glfw/glfw/issues/57) and [pull 1687](https://github.com/glfw/glfw/pull/1678)). The
by [issue #57](https://github.com/glfw/glfw/issues/57) and [pull #1678](https://github.com/glfw/glfw/pull/1678)). The
presenter also handles the [`hid`](#hid) and OpenGL window using [`soglb`](#soglb).

Once the `Presenter` is initialized, the user's chosen render settings are applied, their input config is applied, and (
Expand Down Expand Up @@ -166,7 +166,12 @@ different animation state handler.
### objects

Contains everything that defines the game entities. The enemies' behaviours are defined here, as well as objects'
behaviours. The `update()` function is called each frame for every active object. There are usually custom serialization
behaviours. The `updateLogic()` function is called each logic tick (30 FPS) for every active object. To support smooth
rendering at higher frame rates, the engine uses a predictive interpolation system. At the end of each logic tick,
`applyLogicTransform()` is called to calculate the predicted state for the next tick. During rendering,
`interpolateTransform()` lerps between the current and predicted states.

There are usually custom serialization
overrides for entities that have specific state variables (see also [`serialization`](#serialization)), and also custom
`collide()` overrides to handle collisions with Lara (like the hand of Midas or switches). Some entities like bridges
are also able to change the effective ceiling or floor height when they're activated through [`floordata`](#floordata).
Expand Down
2 changes: 1 addition & 1 deletion iwyu-mappings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

- include: [ "@<pybind11/detail/.*>", "private", "<pybind11/pybind11.h>", "public" ]

- symbol: [ "gsl::not_null", "private", "<gsl/gsl-lite.hpp>", "public" ]
- symbol: [ "gsl::not_null", "private", "<gsl-lite/gsl-lite.hpp>", "public" ]

- symbol: [ "serialization::Serializer", "private", "\"serialization/serialization_fwd.h\"", "public" ]

Expand Down
8 changes: 8 additions & 0 deletions share/shaders/bindings.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#define BINDING_UNIFORM_TRANSFORM 0
#define BINDING_UNIFORM_CAMERA 1
#define BINDING_UNIFORM_CSM 2
#define BINDING_BUFFER_LIGHTS 3
#define BINDING_BUFFER_DYN_LIGHTS 4
#define BINDING_UNIFORM_CSMVSM 4
#define BINDING_BUFFER_BONE_TRANSFORM 10
#define BINDING_BUFFER_NEXT_BONE_TRANSFORM 11
21 changes: 7 additions & 14 deletions share/shaders/bloom_upsample.frag
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,13 @@ layout(location=0) out vec3 out_tex;
void main()
{
const vec2 texelSize = 1.0 / vec2(textureSize(u_input, 0));
const float x = texelSize.x;
const float y = texelSize.y;
const float x = texelSize.x * 0.5;
const float y = texelSize.y * 0.5;

vec3 a = texture(u_input, vec2(fpi.texCoord.x - x, fpi.texCoord.y + y)).rgb;
vec3 b = texture(u_input, vec2(fpi.texCoord.x, fpi.texCoord.y + y)).rgb;
vec3 c = texture(u_input, vec2(fpi.texCoord.x + x, fpi.texCoord.y + y)).rgb;
vec3 a = texture(u_input, fpi.texCoord + vec2(-x, y)).rgb;
vec3 b = texture(u_input, fpi.texCoord + vec2(x, y)).rgb;
vec3 c = texture(u_input, fpi.texCoord + vec2(-x, -y)).rgb;
vec3 d = texture(u_input, fpi.texCoord + vec2(x, -y)).rgb;

vec3 d = texture(u_input, vec2(fpi.texCoord.x - x, fpi.texCoord.y)).rgb;
vec3 e = texture(u_input, vec2(fpi.texCoord.x, fpi.texCoord.y)).rgb;
vec3 f = texture(u_input, vec2(fpi.texCoord.x + x, fpi.texCoord.y)).rgb;

vec3 g = texture(u_input, vec2(fpi.texCoord.x - x, fpi.texCoord.y - y)).rgb;
vec3 h = texture(u_input, vec2(fpi.texCoord.x, fpi.texCoord.y - y)).rgb;
vec3 i = texture(u_input, vec2(fpi.texCoord.x + x, fpi.texCoord.y - y)).rgb;

out_tex = (e*4.0 + (b+d+f+h)*2.0 + (a+c+g+i)) / 16.0;
out_tex = (a + b + c + d) * 0.25;
}
4 changes: 3 additions & 1 deletion share/shaders/camera_interface.glsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
layout(std140, binding=1) uniform Camera {
#include "bindings.glsl"

layout(std140, binding=BINDING_UNIFORM_CAMERA) uniform Camera {
mat4 projection;
mat4 view;
mat4 viewProjection;
Expand Down
2 changes: 1 addition & 1 deletion share/shaders/composition.frag
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void main()
#ifndef DOF
finalColor *= texture(u_texture, uv).rgb;
#else
finalColor *= do_dof(uv);
finalColor *= do_dof(uv, shadeDepth);
#endif
finalColor = mix(finalColor, vec3(texel_shade(shadeDepth)), whiteness);

Expand Down
6 changes: 5 additions & 1 deletion share/shaders/csm_depth_only.vert
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ uniform mat4 u_mvp;
void main()
{
#ifdef SKELETAL
gl_Position = u_mvp * boneTransform.m[int(a_boneIndex)] * vec4(a_position, 1);
gl_Position = mix(
u_mvp * boneTransform.m[int(a_boneIndex)] * vec4(a_position, 1),
u_mvp * nextBoneTransform.m[int(a_boneIndex)] * vec4(a_position, 1),
u_interTickFactor
);
#else
gl_Position = u_mvp * vec4(a_position, 1);
#endif
Expand Down
4 changes: 3 additions & 1 deletion share/shaders/csm_interface.glsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "bindings.glsl"

const int CSMSplits = 4;

layout(std140, binding=2) uniform CSM {
layout(std140, binding=BINDING_UNIFORM_CSM) uniform CSM {
mat4 lightMVP[CSMSplits];
vec3 lightDir;
} csm;
6 changes: 5 additions & 1 deletion share/shaders/depth_only.vert
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ void main()
gpi.color = a_color;

#ifdef SKELETAL
vec4 vtx = camera.viewProjection * modelTransform.m * boneTransform.m[int(a_boneIndex)] * vec4(a_position, 1);
vec4 vtx = mix(
camera.viewProjection * modelTransform.m * boneTransform.m[int(a_boneIndex)] * vec4(a_position, 1),
camera.viewProjection * modelTransform.m * nextBoneTransform.m[int(a_boneIndex)] * vec4(a_position, 1),
u_interTickFactor
);
#else
vec4 vtx = camera.viewProjection * modelTransform.m * vec4(a_position, 1);
#endif
Expand Down
40 changes: 17 additions & 23 deletions share/shaders/dof.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,35 @@ const float DofBlurRange = 3;

vec2 dof_texel = 1.0 / vec2(textureSize(u_texture, 0));

vec3 do_dof(in vec2 uv)
vec3 do_dof(in vec2 uv, in float geomDepth)
{
float depth = -texture(u_geometryPosition, uv).z * InvFarPlane;
float depth = geomDepth * InvFarPlane;
float blur_amount = clamp((abs(depth-dof_focal_depth) - dof_start) / dof_dist, -DofBlurRange, DofBlurRange);

const float NAmount = 0.001;//dither amount
vec2 noise = noise2(uv) * NAmount * blur_amount;

const int Samples = 3;//samples on the first ring
const float BokehBias = 0.5;//bokeh edge bias
vec2 blur_radius = dof_texel * blur_amount + noise;

vec3 col = texture(u_texture, uv).rgb;
float weight_sum = 1.0;

const int Rings = 3;
const float BokehDelta = 1.0 / Rings;
float bokehFactor = 0;
for (int i = 1; i <= Rings; ++i)
const vec2 samples[12] = vec2[](
vec2(1.000000, 0.000000), vec2(-0.500000, 0.866025), vec2(-0.500000, -0.866025),
vec2(2.000000, 0.000000), vec2(0.000000, 2.000000), vec2(-2.000000, 0.000000), vec2(0.000000, -2.000000),
vec2(3.000000, 0.000000), vec2(0.927051, 2.853170), vec2(-2.427051, 1.763356), vec2(-2.427051, -1.763356), vec2(0.927051, -2.853170)
);
const float sampleWeights[12] = float[](
0.500000, 0.500000, 0.500000,
0.666667, 0.666667, 0.666667, 0.666667,
0.833333, 0.833333, 0.833333, 0.833333, 0.833333
);

for (int i = 0; i < 12; ++i)
{
int ringsamples = int(sqrt(i) * Samples);
float angleDelta = PI * 2.0 / float(ringsamples);

float angle = 0;
for (int j = 0; j < ringsamples; ++j)
{
vec2 dxy = vec2(cos(angle), sin(angle)) * float(i);
float weight = mix(1.0, bokehFactor, BokehBias);
vec2 sampleUv = dxy*blur_radius + uv;
col = texture(u_texture, sampleUv).rgb * weight + col;
weight_sum += weight;
angle += angleDelta;
}

bokehFactor += BokehDelta;
col += texture(u_texture, samples[i] * blur_radius + uv).rgb * sampleWeights[i];
weight_sum += sampleWeights[i];
}

return col / weight_sum;
}
8 changes: 5 additions & 3 deletions share/shaders/dust.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
layout(early_fragment_tests) in;

layout(location=0) out vec4 out_color;
layout(location=0) uniform vec3 u_baseColor;

Expand All @@ -11,5 +9,9 @@ in DustFSInterface {

void main()
{
out_color = vec4(toLinear(u_baseColor)*fs.alpha, fs.alpha);
vec2 coord = gl_PointCoord - vec2(0.5);
if (dot(coord, coord) > 0.25) {
discard;
}
out_color = vec4(toLinear(u_baseColor) * fs.alpha, fs.alpha);
}
54 changes: 0 additions & 54 deletions share/shaders/dust.geom

This file was deleted.

Loading