Skip to content

Commit

Permalink
Merge pull request #217 from OGSR/dev [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
xrSimpodin committed Aug 8, 2020
2 parents 37d0720 + 48882d0 commit 1959fbb
Show file tree
Hide file tree
Showing 222 changed files with 1,970 additions and 12,553 deletions.
2 changes: 1 addition & 1 deletion .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<a href="https://github.com/OGSR/OGSR-Engine/releases/latest"><img src="https://img.shields.io/github/downloads/OGSR/OGSR-Engine/total.svg?style=flat-square" alt="Total downloads"></a>
<a href="https://github.com/OGSR/OGSR-Engine/actions?query=branch%3Adev+event%3Apush+workflow%3A%22Main+Workflow%22"><img src="https://img.shields.io/github/workflow/status/OGSR/OGSR-Engine/Main%20Workflow?label=build&logo=github&style=flat-square" alt="Build Status"></a>

![Logo](https://cdn1.radikalno.ru/uploads/2019/6/13/b1b4c50115286e39d7c118897816d78d-full.png)
![Logo](https://camo.githubusercontent.com/abf193ef26e3b22a66cc0cf2a4bcb63a345d7620/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f3534353632383830383438313334313434302f3733303737383730323636393135323239362f6c6f676f2e706e67)

### Цели проекта: ###
* Исправление ошибок оригинального движка
Expand Down
Binary file modified 3rd_party/Src/OpenAL_Soft/bin/x64/soft_oal.dll
Binary file not shown.
Binary file modified 3rd_party/Src/OpenAL_Soft/bin/x86/soft_oal.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions 3rd_party/Src/OpenAL_Soft/include/AL/alc.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ extern "C" {
#define ALC_VERSION_0_1 1

/** Opaque device handle */
typedef struct ALCdevice_struct ALCdevice;
typedef struct ALCdevice ALCdevice;
/** Opaque context handle */
typedef struct ALCcontext_struct ALCcontext;
typedef struct ALCcontext ALCcontext;

/** 8-bit boolean */
typedef char ALCboolean;
Expand Down
21 changes: 21 additions & 0 deletions 3rd_party/Src/OpenAL_Soft/include/AL/alext.h
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,27 @@ ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname,
#endif
#endif

#ifndef AL_SOFT_direct_channels_remix
#define AL_SOFT_direct_channels_remix 1
#define AL_DROP_UNMATCHED_SOFT 0x0001
#define AL_REMIX_UNMATCHED_SOFT 0x0002
#endif

#ifndef AL_SOFT_bformat_ex
#define AL_SOFT_bformat_ex 1
#define AL_AMBISONIC_LAYOUT_SOFT 0x1997
#define AL_AMBISONIC_SCALING_SOFT 0x1998

/* Ambisonic layouts */
#define AL_FUMA_SOFT 0x0000
#define AL_ACN_SOFT 0x0001

/* Ambisonic scalings (normalization) */
/*#define AL_FUMA_SOFT*/
#define AL_SN3D_SOFT 0x0001
#define AL_N3D_SOFT 0x0002
#endif

#ifdef __cplusplus
}
#endif
Expand Down
1 change: 1 addition & 0 deletions 3rd_party/Src/OpenAL_Soft/include/AL/efx.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef AL_EFX_H
#define AL_EFX_H

#include <float.h>

#include "alc.h"
#include "al.h"
Expand Down
Binary file modified 3rd_party/Src/OpenAL_Soft/libs/x64/OpenAL32.lib
Binary file not shown.
Binary file modified 3rd_party/Src/OpenAL_Soft/libs/x64/libOpenAL32.dll.a
Binary file not shown.
Binary file modified 3rd_party/Src/OpenAL_Soft/libs/x86/OpenAL32.lib
Binary file not shown.
Binary file modified 3rd_party/Src/OpenAL_Soft/libs/x86/libOpenAL32.dll.a
Binary file not shown.
6 changes: 2 additions & 4 deletions Engine.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2010
# Visual Studio Version 16
VisualStudioVersion = 16.0.30128.74
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libvorbis_static", "3rd_party\Src\Xiph\libvorbis\win32\VS2010\libvorbis\libvorbis_static.vcxproj", "{0F3163C6-FAE6-4FBD-BF88-037EB0420DAF}"
EndProject
Expand Down Expand Up @@ -207,11 +207,9 @@ Global
{EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}.Debug|x64.ActiveCfg = Release|x64
{EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}.Debug|x64.Build.0 = Release|x64
{EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}.Debug|x86.ActiveCfg = Release|x64
{EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}.Debug|x86.Build.0 = Release|x64
{EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}.Release|x64.ActiveCfg = Release|x64
{EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}.Release|x64.Build.0 = Release|x64
{EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}.Release|x86.ActiveCfg = Release|x64
{EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}.Release|x86.Build.0 = Release|x64
{AC9B12ED-A2D7-4337-A981-5BD8430E96D8}.Debug|x64.ActiveCfg = Debug|x64
{AC9B12ED-A2D7-4337-A981-5BD8430E96D8}.Debug|x64.Build.0 = Debug|x64
{AC9B12ED-A2D7-4337-A981-5BD8430E96D8}.Debug|x86.ActiveCfg = Debug|Win32
Expand Down
Binary file modified Game/Resources_SoC_1.0006/gamedata/shaders/r2/combine_1.ps
Binary file not shown.
Binary file modified Game/Resources_SoC_1.0006/gamedata/shaders/r3/combine_1.ps
Binary file not shown.
Binary file modified Game/Resources_SoC_1.0006/gamedata/shaders/r3/ogsr_sslr.ps
Binary file not shown.
173 changes: 96 additions & 77 deletions Game/Resources_SoC_1.0006/gamedata/shaders/r3/reflections.h
Original file line number Diff line number Diff line change
@@ -1,19 +1,38 @@
#ifndef REFLECTIONS_H
#define REFLECTIONS_H
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Anomaly shaders 1.5 //
//Credits to KD, Anonim, Crossire, daemonjax, Zhora Cementow, Meltac, X-Ray Oxygen, FozeSt, Zagolski, SonicEthers, //
//David Hoskins, BigWIngs //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//*******************************************************************************************************************
#ifdef USE_OGSE_REFLECTIONS
/*
\\\\\\Screen Space Reflections//////
Credits goes to Xerxes1138, Danil Baryshev, and ForHaxed.
References:
https://habr.com/ru/post/244367/
https://github.com/Xerxes1138/UnitySSR/
https://www.amk-team.ru/forum/topic/14078-sslr
If you want to use this code in your project
just keep this header ;) Make modding better.
By LVutner for X-Ray Oxygen project (2020)
*/

//#define SSR_JITTER //Enables jittering

#define REFL_RANGE 100
#define SKY_DEPTH float(10000.f)
#define SKY_EPS float(0.001)
uniform float3 eye_direction;
uniform float4 screen_res;
#define SSR_EDGE_ATTENUATION float(0.09) //Edge attenuation intensity
#define SSR_JITTER_INTENSITY float(0.05) //Jittering intensity

#define SSR_SAMPLES int(20) // Extreme
#define SSR_DISTANCE float(400.0)

uniform float4 screen_res; // Screen resolution (x-Width,y-Height, zw - 1/resolution)

/*Helper functions*/
float RayAttenBorder(float2 pos, float value)
{
float borderDist = min(1.0 - max(pos.x, pos.y), min(pos.x, pos.y));
return saturate(borderDist > value ? 1.0 : borderDist / value);
}

float4 proj_to_screen(float4 proj)
{
Expand All @@ -24,82 +43,82 @@ float4 proj_to_screen(float4 proj)
return screen;
}

float get_depth_fast(float2 tc)
half is_sky(float depth)
{
#ifndef USE_MSAA
return s_position.Sample( smp_nofilter, tc).z;
#else
return s_position.Load( int3( tc * pos_decompression_params2.xy ,0),0 ).z;
#endif
return step(abs(depth - 10000.f), 0.001);
}

float is_sky(float depth) { return step(abs(depth - SKY_DEPTH), SKY_EPS); }
#ifdef SSR_JITTER
float3 hash(float3 a)
{
a *= timers.x;
a = frac(a * 0.8f);
a += dot(a, a.yxz + 19.19);
return frac((a.xxy + a.yxx)*a.zyx);
}
#endif

float4 get_reflection(float3 screen_pixel_pos, float3 next_screen_pixel_pos, float3 reflect)
float4 compute_ssr(float3 position, float3 normal)
{
float4 final_color = {1.0,1.0,1.0,1.0};
float2 factors = {1.f,1.f};

float3 main_vec = next_screen_pixel_pos - screen_pixel_pos;
float3 grad_vec = main_vec / (max(abs(main_vec.x), abs(main_vec.y)) * 256);

// handle case when reflect vector faces the camera
factors.x = dot(eye_direction, reflect);
/*Initialize step size and error*/
float step = 1.0f/float(SSR_SAMPLES);
int reflection = 1;

if ((factors.x < -0.5) || (screen_pixel_pos.z > REFL_RANGE)) return final_color;
else
/*Initialize reflected TC*/
float2 refl_tc = (0,0);

/*Prepare ray direction and reflection vector*/
float3 v2point = normalize(position - eye_position);
float3 vreflect = normalize(reflect(v2point,normalize(normal)));

/*Main loop*/
[unroll (SSR_SAMPLES)] for(int i = 0; i < SSR_SAMPLES; i++)
{
float3 curr_pixel = screen_pixel_pos;
curr_pixel.xy += float2(0.5,0.5)*screen_res.zw;
float max_it = 64;
float i = 0;
bool br = false;

while ((i < max_it) && (br == false))
{
curr_pixel.xyz += grad_vec.xyz;
float depth = get_depth_fast(curr_pixel.xy);
depth = lerp(depth, 0.f, is_sky(depth));
float delta = step(depth, curr_pixel.z)*step(screen_pixel_pos.z, depth);
if (delta > 0.5)
{
final_color.xyz = s_image.Sample( smp_rtlinear, curr_pixel.xy).xyz;
float2 tmp = curr_pixel.xy;
tmp.y = lerp(tmp.y, 0.5, step(0.5, tmp.y));
float screendedgefact = saturate(distance(tmp , float2(0.5, 0.5)) * 2.0);
final_color.w = pow(screendedgefact,6);
br = true;
}
i += 1.0;
}
return lerp(final_color,float4(1.0,1.0,1.0,1.0),screen_pixel_pos.z/REFL_RANGE);
/*Prepare new position*/
float3 new_position = position + vreflect * step;

/*Add hash to new position*/
#ifdef SSR_JITTER
new_position += hash(position.xyz) * SSR_JITTER_INTENSITY;
#endif

/*Convert new position to texcoord*/
float4 proj_position = mul(m_VP, float4(new_position, 1.f));
float4 p2ss = proj_to_screen(proj_position);
refl_tc.xy = p2ss.xy /= p2ss.w;

/*Sample hit depth*/
float hit_depth = s_position.Load(int3(refl_tc.xy * screen_res.xy,0),0).z;

/*Intersect sky from hit depth*/
hit_depth = lerp(hit_depth, 0.f, is_sky(hit_depth));

/*Sample depth*/
float depth = mul(m_V, float4(position, 1.f)).z;

/*Fixing incorrect refls*/
if((depth - hit_depth) > 0.0f || (hit_depth > SSR_DISTANCE))
reflection = 0;

/*Depth difference*/
step = length(hit_depth - depth);
}
}

float4 calc_reflections(float4 pos, float3 vreflect)
{
float4 refl = {1.0,1.0,1.0,1.0};
float3 v_pixel_pos = mul((float3x4)m_V, pos);
float4 p_pixel_pos = mul(m_VP, pos);
float4 s_pixel_pos = proj_to_screen(p_pixel_pos);
s_pixel_pos.xy /= s_pixel_pos.w;
s_pixel_pos.z = v_pixel_pos.z;

float3 reflect_vec = normalize(vreflect);
float3 W_m_point = pos.xyz + reflect_vec;

float3 V_m_point = mul((float3x4)m_V, float4(W_m_point, 1.0));
float4 P_m_point = mul(m_VP, float4(W_m_point, 1.0));
float4 S_m_point = proj_to_screen(P_m_point);
S_m_point.xy /= S_m_point.w;
S_m_point.z = V_m_point.z;

refl = get_reflection(s_pixel_pos.xyz, S_m_point.xyz, reflect_vec);

return refl;
/*Edge attenuation*/
float edge = RayAttenBorder(refl_tc.xy, SSR_EDGE_ATTENUATION);

/*Sample image with reflected TC*/
float3 img = s_diffuse.Load(int3(refl_tc.xy * screen_res.xy,0),0);

/*Image.rgb, Reflcontrol.a*/
return float4(img.xyz, reflection*edge);
}
#endif
//*******************************************************************************************************************
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Anomaly shaders 1.5 //
//Credits to KD, Anonim, Crossire, daemonjax, Zhora Cementow, Meltac, X-Ray Oxygen, FozeSt, Zagolski, SonicEthers, //
//David Hoskins, BigWIngs //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//*******************************************************************************************************************
TextureCube s_env0;
TextureCube s_env1;
Expand Down
Binary file modified Game/Resources_SoC_1.0006/gamedata/shaders/r3/water.ps
Binary file not shown.
52 changes: 0 additions & 52 deletions ogsr_engine/COMMON_AI/ItemListTypes.h

This file was deleted.

0 comments on commit 1959fbb

Please sign in to comment.